Mega Code Archive

 
Categories / Ruby / Array
 

Each method goes through each element of the array and passes it as a parameter to the code block you supply

[1, "test", 2, 3, 4].each { |element| puts element.to_s + "X" }