Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
language:controlflow [2022/07/17 08:06]
rajit [Loops]
language:controlflow [2022/07/17 08:07]
rajit [Loops]
Line 78: Line 78:
 The syntactic replication construct is written as follows: The syntactic replication construct is written as follows:
 <code act> <code act>
-(sym id : range : body(id) )+(sym id : range : body )
 </code> </code>
-The ''sym'' (symbol) might be empty. ''id'' is a variable that can be used in ''body(id)'', and takes the range specified by ''range''. ''range'' can be either an integer-valued expression or ''start .. end'' to indicate a start and end index. The result of the replication is+The ''sym'' (symbol) might be empty. ''id'' is a variable that can be used in ''body'', and takes the range specified by ''range''. ''range'' can be either an integer-valued expression or ''start .. end'' to indicate a start and end index. The result of the replication is
 <code act> <code act>
- body(lo) sym body(lo+1) sym ... sym body(hi)+ body(id set to lo) sym body(id set to lo+1) sym ... sym body(id set to hi)
 </code> </code>
-where ''lo'' is the starting index of the range, and ''hi'' is the ending index.+where ''lo'' is the starting index of the range, and ''hi'' is the ending index, and ''body(id set to x)'' means ''body'' with the value of ''x'' substituted by the constant ''id''.