title: How can I add the second string of an array to the first string of the same array, ruby
body: <p>I have an array of cities and states. Looks something like this: </p>
  
  <pre><code>locations = ["Colorado Springs","CO","Denver","CO","Kissimmee","FL","Orlando", "FL"]
  </code></pre>
  
  <p>I would ultimately like to get this result: </p>
  
  <pre><code>locations = ["Colorado Springs, CO","CO","Denver, CO","CO","Kissimmee, FL","FL","Orlando, FL", "FL"]
  </code></pre>
  
  <p>I did this to test: </p>
  
  <pre><code>locations[0] &lt;&lt; ", #{locations[1]}"
  </code></pre>
  
  <p>And got this as a result: </p>
  
  <pre><code>locations = ["Colorado Springs, CO", "CO", "Denver", "CO", "Kissimmee", "FL", "Orlando", "FL"]
  </code></pre>
  
  <p>I am attempting the code below to convert the rest of the array but getting <code>nil</code> as a response:</p>
  
  <pre><code>locations = ["Colorado Springs","CO","Denver","CO","Kissimmee","FL","Orlando", "FL"]
  
  counter0 = 0
  counter1 = 1 
  
  while counter0 &lt; locations.length
    locations[counter0] &lt;&lt; locations[counter1]
    counter0 += 2 
    counter1 += 2
  end 
  
  =&gt; nil
  </code></pre>