Recent Changes - Search:
Email iofreak@yahoo.com with comments and/or suggestions.

Aibo General

Aibo Development

Wiki Help

Aibo Links

R-Code » FOR

FOR...NEXT Statement

Repeatedly executes the block of statements between FOR and NEXT while incrementing or decrementing a "counting" variable.

Models

ERS-210 ERS-220 ERS-31x ERS-7

Syntax

FOR:var:from:to[:step]
...
NEXT

The FOR...NEXT statement syntax has the following parts:

PartDescription
varVariable for incrementing or decrementing.
fromThe value to assign to var at the start of the loop.
toWhen var is equal to this value the loop ends.
stepOptional. Value added to var at each loop iteration, may be negative (to count down). A value of 1 is used by default when step is not specified.

Example(s)


   // count upward from 1 to 10
   FOR:i:1:10
      PRINT:"i=%d":i
   NEXT

   // count downward from 10 to 1
   FOR:i:10:1:-1
      PRINT:"i=%d":i
   NEXT
 

Edit - History - Print - Recent Changes - Search - Site Terms of Use
Page last modified on February 10, 2006, at 08:20 PM CST