#.require. clr @platform clr namespace Test class Test def main # Note: You wouldn't actually use while loops for counting, # but counting makes a good basic test. i as int = 0 while i < 100 i += 1 assert i == 100 i = 0 while i > 0 i = -1 assert i == 0 i = 0 post while i > 0 i = -1 assert i == -1 i = 100 while i i -= 1 assert i == 0 # 2006-12-16: there was a bug where post while generates both a while loop and a do-while loop count = 0 i = 10 post while i > 0 i -= 1 count += 1 assert count == 10 random = Random() a = 1 while a <= 3 post while .check(a, b) # using local var `b` which is first assigned below b = random.next(3) + 1 a += 1 def check(a as int, b as int) as bool assert b <> 0 # verifies that the while condition is not checked immediately return a <> b