forever

Run a part of the program in the background and keep running it over again.

loops.forever(function() {
})

The code you have in a ||loops:forever|| loop will run and keep repeating itself the whole time your program is active. Code in other parts of your program won’t stop while your ||loops:forever|| loop is running. This includes other ||loops:forever|| loops and the ||loops:run in background|| block.

Parameters

  • body: the code to keep running over and over again.

Example

Continuously make an ice stairway. Every 2 seconds, add another ice step to the stairway.

let y = 0
let z = 0
loops.forever(function () {
    blocks.place(ICE, pos(0, y, z))
    y += 1
    z += 1
    loops.pause(2000)
})

See also

while, repeat, run in background