The following code generates times-table
:
times-table := [x * y, x: 2 ~ 9, y: 1 ~ 9]
The code is equivalent to:
times_table = [x * y for x in xrange(2, 10) for y in xrange(1, 10)]
in Python.
2 ~ 9
makes a <range>
from 2
to 9
. It is equivalent to <range>(min: 2, max: 9)
.
The following code generates a list of odd numbers from 1 to 100:
odds := [x, x: 1 ~ 100, x isa? <odd-number>]