There are several other control structures related to generation. Procedures can be used to add generators to Icon's built-in repertoire. The suspend control structure returns a value from the procedure, but leaves it in suspension so that it can be resumed for another value. When the loop terminates, control flows off the end of the procedure without producing another value. String Scanning For complicated operations, the bookkeeping involved in keeping track of positions in strings becomes burdensome and error prone.
Icon has a string scanning facility that is manages positions automatically.
Attention is focused on a current position in a string as it is examined by a sequence of operations. A position in the subject, which starts at 1, is the focus of examination. Matching functions change this position. Note that no value is written if the subject is not long enough. In this context, the string that they operate on is not specified and is taken to be the subject.