Welcome to the Creatures Wiki! Log in and join the community.

Difference between revisions of "REPS"

From Creatures Wiki
Jump to navigation Jump to search
(c2e caos)
 
Line 22: Line 22:
  
 
[[Category:C3 CAOS Commands]]
 
[[Category:C3 CAOS Commands]]
 +
[[Category:C2 CAOS Commands]]

Revision as of 21:02, 31 January 2020

REPS is a CAOS command controlling flow.

Usage

REPS n (int) .. REPE

This creates a bounded loop. REPS opens the loop block and REPE closes it again. The loop block is repeated n times, and then execution continues at the point after REPE.

Example

Output the factorial of va00:

SETV va01 1
REPS va00
  MULV va01 va00
  SUBV va00 1
REPE
OUTV va01

See also