max = 999 (0..max).each do |i| if i / 10 == 0 puts "00#{i}" elsif i / 100 == 0 puts "0#{i}" end STDOUT.flush break if gets.chomp == "unlocked" end