simple-exercises/ruby-exercises/easy-6.rb
#oddball_sum
#Write a function oddball_sum(numbers),
# which takes in an array of integers and
# returns the sum of all the odd elements.
oddball_sum
Write a function oddball_sum(numbers),
which takes in an array of integers and
returns the sum of all the odd elements.
oddball_sum Write a function oddball_sum ( numbers ) which takes in an array of integers and returns the sum of all the odd elements .
def oddball_sum(nums)
  odd_sum = 0
  nums.each do |n|
    if n % 2 == 1
      odd_sum += n
    end
  end
  odd_sum
end
def oddball_sum ( nums ) odd_sum = 0 nums . each do | n | if n % 2 == 1 odd_sum += n end end odd_sum end
oddball_sum
Write a function oddball_sum(numbers),
which takes in an array of integers and
returns the sum of all the odd elements.
oddball_sum Write a function oddball_sum ( numbers ) which takes in an array of integers and returns the sum of all the odd elements .
nums
<not_specific>