Methods, Blocks, & Sorting


Let's go over what we learned about blocks.

numbers = [5, 2, 8]
sum = 0
numbers.each do |n|
  sum += n
puts sum

The example above is just a reminder about syntax. We calculate the sum of a list of numbers.

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.