while loops can now be used as expressions -- they return an array containing the computed result of each iteration.

This commit is contained in:
Jeremy Ashkenas
2010-01-13 21:27:22 -05:00
parent 1e7d638435
commit bb9fdd3015
5 changed files with 46 additions and 10 deletions

View File

@@ -0,0 +1,17 @@
i: 100
while i -= 1
print(i is 0)
i: 5
list: while i -= 1
i * 2
print(list.join(' ') is "8 6 4 2")
i: 5
list: (i * 3 while i -= 1)
print(list.join(' ') is "12 9 6 3")