r Statement (Repeat Statement)

Name

r --  Starts a repeated section.

Description

Starts a repeated section, which lasts until the next s, r or e statement.

Syntax

r p1 p2

Initialization

p1 -- Number of times to repeat the section.

p2 -- Macro(name) to advance with each repetition (optional).

Performance

In order that the sections may be more flexible than simple editing, the macro named p2 is given the value of 1 for the first time through the section, 2 for the second, and 3 for the third. This can be used to change p-field parameters, or ignored.

Warning

Because of serious problems of interaction with macro expansion, sections must start and end in the same file, and not in a macro.

Examples

In the following example, the section is repeated 3 times. The macro NN is used and advanced with each repetiton.

r3  NN  ;start of repeated section - use macro NN
    some code
    .
    .
    .
s       ;end repeat - go back to previous r if repetitions < 3
        

Credits

Author: John ffitch
University of Bath/Codemist Ltd.
Bath, UK
April, 1998

New in Csound version 3.48