For

Verb: for

Repeats the execution of a command block, using a variable to control the amount of repetitions.

Syntax

for --variable(Numeric) --from(Numeric) --to(Numeric) --step(Numeric)

Inputs

Script Designer Required AcceptedTypes Description
--variable Variable Required Number Variable to control the amount of repetitions. When its value reaches the value of To, the repetitions stop.
--from From Required Number Value that indicates the beginning of the repetition.
--to To Required Number Value indicating the completion of the repetition.
--step Step Required Number Value that increments the value of Variable with each repetition.

Example

The For command repeats the execution of the command block until the value of the variable iterator reaches 5.

defVar --name iterator --type Numeric
for --variable ${iterator} --from 1 --to 5 --step 1
	logMessage --message "Repetition number: ${iterator}" --type "Info"
next
logMessage --message "End for" --type "Info"
// Repeat the command block 5 times.

Remarks

The values inserted in the From, To and Step parameters must be of the Number type.

See Also

  • Begin Do-While
  • Case
  • Continue
  • Else
  • Else If
  • End Case
  • End Do-While
  • End For Each
  • End If
  • End While
  • Execute Subroutines
  • For Each
  • Go to
  • Go to If
  • If
  • Insert Label
  • Interrupt Loop
  • Next
  • Otherwise
  • Return from Subroutine
  • Run Subroutine
  • Run Subroutine If
  • Then
  • When
  • While