Ruby: introduction to blocks
Example:
[1,2,3].each do |i|
puts i
end
Blocks are code between braces or between do and end.
Solution:
[1,2,3].each { |i| puts i } // Alternative using braces
Example: Solution:Ruby: introduction to blocks
Blocks are code between braces or between do and end.
[1,2,3].each do |i|
puts i
end
[1,2,3].each { |i| puts i } // Alternative using braces