Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags |
|||
Line 115:
The Generator expression example for Icon can be simplified and does not require a co-expression.
<
local j
every j := (|seq(0) \ 20) ^2 do # Produced the first 20 squares
write(j)
</syntaxhighlight>
If the idea is to demonstrate really what Icon can do in terms of using generators outside a loop construct, the following may be a better example
<
# find the first matching element
a := [1,2,3,4]
b := [5,6,2,7]
c := ( !a = !b ) | &null # assign first matching element, or set to &null
</syntaxhighlight>
[[User:CheyenneWills|CheyenneWills]] ([[User talk:CheyenneWills|talk]]) 20:01, 16 June 2010 (UTC)
|