Mega Code Archive

 
Categories / Ruby / Method
 

Use code blocks with Ruby iterators like each, upto, downto, and times

["Hello", "there", "sweetie."].each {|word| puts word} 4.upto(8) {|loop_index_value| puts loop_index_value} 4.times {print "X"}