for loop syntax ruby code example Example: ruby for loop for i in 0..2 do print(i) end # => 0 # => 1 # => 2