Skip to main content

Module for_statement

Module for_statement 

Source
Expand description

for loop parser - three distinct syntaxes.

rl-lang supports three for forms:

// 1. C-style: initializer, condition, increment inside brackets
for [int i = 0, i < 10, i += 1] { … }

// 2. Range iteration: integer variable over a literal range
for x in 0..10 { … }

// 3. Foreach: variable over an array variable or expression
for item in my_array { … }

The leading token after for disambiguates the form: