Skip to main content
Version: 1.0.2

BREAK

BREAK statement

The BREAK statement can be used to break out of a loop, like within the FOR-statement.

Statement syntax

SurrealQL Syntax
BREAK

Example usage

The following query shows example usage of this statement.

-- Create a person for everyone in the array where the number is lower than or equal to 5
FOR $num IN [1, 2, 3, 4, 5, 6, 7, 8, 9] {
IF ($num > 5) {
BREAK;
};

CREATE person:$num;
};