=begin

### P-roblem

Write a method that returns an Array that contains every other element of an Array that is passed in as an argument. The values in the returned list should be those values that are in the 1st, 3rd, 5th, and so on elements of the argument Array.

# link: https://launchschool.com/exercises/7ced73ba

# input: array
# output: array

## requirements / assumptions

- method takes 1 argument, an array
- empty array returns, an empty array

### E-xample

oddities([2, 3, 4, 5, 6]) == [2, 4, 6]
oddities([1, 2, 3, 4, 5, 6]) == [1, 3, 5]
oddities(['abc', 'def']) == ['abc']
oddities([123]) == [123]
oddities([]) == []

### D-ata structure

- array

### A-lgorithm

- use each with index, select element with an even index

=end

### C-ode

def oddities(arr)
  new_arr = []
  arr.each_with_index{ |elem, index| new_arr << elem if index.even? }
  new_arr
end

p oddities([2, 3, 4, 5, 6]) == [2, 4, 6]
p oddities([1, 2, 3, 4, 5, 6]) == [1, 3, 5]
p oddities(['abc', 'def']) == ['abc']
p oddities([123]) == [123]
p oddities([]) == []
