95-733 Internet Technologies
39
Code Blocks
#Introductory code blocks
4.times {puts "Yo!"}
#A block with a parameter
#and using the each iterator
list = [2,4,6,8]
list.each {|v| puts v}
Output
======
Yo!
Yo!
Yo!
Yo!
2
4
6
8