Usage
for x in s repeat { ...}
for x in generator s repeat { ...}
Signature
generator: % Generator Z
Parameter | Type | Description |
---|---|---|
s | % | a segment |
Description
This functions allows a segment to be iterated. This generator yields the integers of s in succession.
Example
The following code computes the sum of all the positive even machine integers that are smaller than :
evenSum(n:MachineInteger):MachineInteger == { s := 0; for x in 2..prev(n) by 2 repeat s := s + x; s; }