Relational Operators
- Updated2025-10-31
- 2 minute(s) read
Use relational operators to evaluate conditions.
| Operator | Meaning |
|---|---|
| == | Check for equal to |
| >= | Check for greater than or equal to |
| > | Check for greater than |
| <= | Check for less than or equal to |
| < | Check for less than |
| != | Check for not equal to |
not Conditions
Negate the conditions using the keyword not.
not Condition
Example: not Condition
jsonValue v if not v:IsNull then // ... endif jsonObject o if not o:IsEmptyOrNone() then // ... endif
Logical Operators
Combine conditions using logical operators.
Condition Logical Operator Condition
| Logical Operator | Meaning |
|---|---|
| and | Both conditions must be met for the condition to be true. |
| or | At least one of the conditions must be met for the condition to be true. |
Example: Logical Operators
program
section globals
int32 x
endsection
int32 a = 0
if ( a == 1 and x < 0 ) or ( a > 0 ) then
//code
endif
endprogram
if Conditions
Use an if condition to execute code that is linked to a condition.
The syntax is:
if Condition1 then
// Code
elseif Condition2 then
// Code
else
// Code
endif
- An if condition always starts with an if part and finishes with an endif part.
- The else branch and the endif branches are optional.
- You can use any number of elseif conditions.
- A line break must follow then.
- The if / elseif / else code block cannot contain any nested if statements.
Example: if Condition
program
section globals
int32 a
int32 b
real64 c
endsection
if a == 1 then
b = 5 * a
c = sin(PI)
elseif a == 2 and b == 2 then
b = 0
c = cos( PI )
else
b = -1
endif
endprogram