while operation ruby code example Example: rails loop while $i < $num do puts("Inside the loop i = #$i" ) $i +=1 end