value = 5; NestWhile[ # + 1 & , value , (Print[#]; Mod[#, 6] != 0) & ];