Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
language:controlflow [2022/05/13 08:45]
rajit
language:controlflow [2022/07/17 08:06]
rajit [Loops]
Line 75: Line 75:
 syntax). The ''&'' symbol separates the body of the loop that is syntax). The ''&'' symbol separates the body of the loop that is
 instantiated for different values of ''i'' instantiated for different values of ''i''
 +
 +The syntactic replication construct is written as follows:
 +<code act>
 +(sym id : range : body(id) )
 +</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
 +<code act>
 + body(lo) sym body(lo+1) sym ... sym body(hi)
 +</code>
 +where ''lo'' is the starting index of the range, and ''hi'' is the ending index.