for i in 0..8 if num[0] != 1 puts 1 break elsif i == 8 break elsif num [i] + 1 != num[i + 1] puts num[i] + 1 break end end