title: Nested if else inside .each iteration
body: <p>I'm wondering if this makes sense or if the syntax is wrong and basically if this is acceptable. I wanted to nest an if/else condition within my iteration of the array.</p>
  
  <pre><code>def change_numbers(first_array, second_array)
    second_array.each do |index|
  
      if first_array[index] == 0
        first_array[index] = 1
      else
        first_array[index] = 0
      end
  
    end
  end
  </code></pre>
  
  <p>The array is a simple (binary) array and will only consist of 0s and 1s and I want to use the second array's elements as the indices of the first array that I am going to change.</p>
  
  <p>Example:</p>
  
  <pre><code>first_array = [0, 0, 0, 0, 1, 1, 1, 1, 1]
  second_array = [3, 5, 7]
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>first_array = [0, 0, 0, 1, 1, 0, 1, 0, 1]
  </code></pre>