NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
The repeat statement

The repeat statement executes a loop a specified number of times.

This control structure is not included in the set of Standard C looping constructs. NXC inherits this statement from NQC. The syntax is shown below.

repeat (expression) body

The expression determines how many times the body will be executed. Note: the expression following the repeat keyword is evaluated a single time and then the body is repeated that number of times. This is different from both the while and do-while loops which evaluate their condition each time through the loop.

Here is an example of how to use the repeat loop:

int i=0;
repeat (8)
NumOut(0, LCD_LINE1-i*8, i++);