fn: while
[contents]

#### Syntax

The syntax for while loops is:

f++:
while{options}(condition)
{
//loop code-block
}


n++:
@while{options}(condition)
{
//loop code-block
}


Note: Single-line code blocks do not need to be enclosed in parentheses.

#### Description

The while function takes a single parameter specifying a loop condition, then loops through the code-block following the call while the loop condition does not evaluate to 0 (for while loops the loop condition is evaluated before each iteration of the loop code-block).

Note: f++ is used for while conditions, even for n++. If you accidentally use n++ for the condition it will most often run without any syntax or semantic errors anyway.

Note: If not writing to the output file Nift will skip to the first non-whitespace (ie. to the first character that is not a space, tab or newline) after a while loop and inject it to the output file where the call started. If you want to prevent Nift from doing this put a '!' after the loop, eg.:

@while{!o}(condition)
{
# block
}!


#### Options

The following options are available for while loops:

option description
f++ parse while loop code-block with f++
n++ parse while loop code-block with n++
!\n do not add newline between each loop iteration
\n add double newline between each loop iteration
eob="value" add value between each loop iteration
option description

#### f++ example

Examples of while being used with f++:

int i=0
while(i < 10)
console("i: i+=1")

int i=0
while{!s, !o}(i+=1; i<10)
console("i: ", i)

#### n++ example

Examples of while being used with n++:

@int i=0
@while{\n}(i < 10)
i:  @++(i)

@int i=0
@while{f++, !o, !s}(i+=1; i < 10)
{
//f++ code for scripting
}