fn: if
[contents]

#### Syntax

The syntax for if statements is:

f++:
if{options}(condition)
{
//code-block
}
else-if(condition)
{
//code-block
}
else
{
//code-block
}


n++:
@if{options}(condition)
{
//code-block
}
else-if(condition)
{
//code-block
}
else
{
//code-block
}


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

#### Description

The if function takes a single parameter specifying a condition and the call is followed by a code-block, if the condition does not evaluate to 0 then the code-block is parsed and all following else-if and else statements are skipped. An if call can be followed by any number of else-if statements and can optionally be ended with a single else statement to be run if none, all of which works as you would expect from other languages.

Note: f++ is used for if and else-if conditions, even for n++. If you accidentally use n++ for any of the conditions 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 an if statement and inject it to the output file where the call started. If you want to prevent Nift from doing this put a '!' after the statement, eg.:

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


#### Options

The following options are available for if statements:

option description
f++ parse code-block with f++
n++ parse code-block with n++
option description

#### f++ example

Example of if being used with f++:

int i=0
if(i < 10)
console("this will print")
else-if(i>10)
console("this will not print")
else
console("this also will not print")

#### n++ example

Example of if being used with n++:

@int i=0
@if(i < 10)
@console("this will print")
else-if(i>10)
@console("this will not print")
else
@console("this also will not print")