Icon+Unicon/Intro: Difference between revisions

Content added Content deleted
Line 161:
 
 
These examples initializes sum and adding all the contents of arglist. The first example uses separate statements, the second too but compresses with a ;, the third is a common contraction, and the last is an error.
<lang Icon>sum := 0 # initial and
every sum +:= !arglist do something() # loop in two statements
 
sum := 0; every sum +:= !arglist do something() # ; splice
 
every (sum := 0) +:= !arglist do something() # a common contraction
 
while sum := 0) +:= !arglist do something() # an error</lang>
 
== Program Flow ==