Skip to content

If

You can execute different code branches according to the condition.

Yes, our if statement is similar to the if statement in other programming languages.

We have if ... else and if ... else if ... else statements.

The following example assigns value to 1 if close is greater than open, otherwise 0.

nvs

Use else for the branch to execute when the condition is not met.

nvs

Use else if to execute different branches according to multiple conditions.

nvs

WARNING

In a if branches, you can't use stateful functions, such as ma, sum.