09.12.2012 Views

Basic Characteristics RAPID

Basic Characteristics RAPID

Basic Characteristics RAPID

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FOR Repeats a given number of times<br />

Example<br />

Arguments<br />

FOR is used when one or several instructions are to be repeated a number of times.<br />

If the instructions are to be repeated as long as a given condition is met, the WHILE<br />

instruction is used.<br />

FOR i FROM 1 TO 10 DO<br />

routine1;<br />

ENDFOR<br />

Repeats the routine1 procedure 10 times.<br />

FOR Loop counter FROM Start value TO End value<br />

[STEP Step value] DO ... ENDFOR<br />

Loop counter Identifier<br />

The name of the data that will contain the value of the current loop counter.<br />

The data is declared automatically and its name should therefore not be the same<br />

as the name of any data that exists already.<br />

Start value Data type: Num<br />

The desired start value of the loop counter.<br />

(usually integer values)<br />

End value Data type: Num<br />

The desired end value of the loop counter.<br />

(usually integer values)<br />

Step value Data type: Num<br />

The value by which the loop counter is to be incremented (or decremented) each loop.<br />

(usually integer values)<br />

If this value is not specified, the step value will automatically be set to 1 (or -1 if<br />

the start value is greater than the end value).<br />

<strong>RAPID</strong> Reference Manual 8-FOR-1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!