FOR

FOR(<#var>,<start>,<end>)

Type: Action

Category: Control Flow

Permission: N/A

Since Minecraft Version: v1.3

Since Version: v0.9

Minor: 9

API: N/A

Patch: N/A


Description

Begins a for loop using the specified <#var> as a loop counter. Needs to be closed with NEXT.

The loop can be exited early by using BREAK.

Alternative syntax:

FOR(<#var> = <start> to <end>)
FOR(<#var> = <start> to <end> step <step>)

Basic example:

log("start");
for(#i,1,5);
    log("#i = %#i%");
next;
log("end");

The basic example must return, in the chat, the following messages:

start
#i = 1
#i = 2
#i = 3
#i = 4
#i = 5
end

Related Resources

Changelog
  • Added em v0.9:
  • Updated em v0.12.1: Can now set step value