ruby way loops code example
Example 1: ruby each do method
array.each do |item|
puts "The current array item is: #{item}"
end
Example 2: rails loop
while $i < $num do
puts("Inside the loop i = #$i" )
$i +=1
end
array.each do |item|
puts "The current array item is: #{item}"
end
while $i < $num do
puts("Inside the loop i = #$i" )
$i +=1
end