Nested for loop : for « Statement « Ruby






Nested for loop


#!/usr/bin/env ruby

for i in 1..12
  for j in 1..12
    print i.to_s + " x " + j.to_s + " = ", j * i, "\n"
  end
end

 








Related examples in the same category

1.general form of the for loop
2.Using the for Loop
3.For each item in