Meta accounts are here: you can create a Meta account to log into VR devices. Learn more


Execute the subsequent codeblocks while a defined condition is met.

Appearance in Composition Pane

The codeblocks indented below the while line will execute when the condition evaluates to true. This is useful when iterating through a list. This codeblock accepts a limited number of instructions to avoid expensive/infinite loops. If you encounter this limit, the script will stop executing and display an error message in the debug panel. Note that on local scripts, the limit is higher and allows for more event executions. Consider using an event loop if you reach any of these limits.

Only booleans are accepted in a while block, however, because logic operators return a boolean, they are also accepted in a while block.

Runs the codeblocks indented below the while, while the boolean is true.


ELSE precedes this tutorial

Example 1: Iterate through a list

This while loop will execute as long as its argument evaluates to true. In this example, it tests if the iterator is greater than 0. With each passage through the loop, the iterator decrements by 1.