# Conditionals

Next: Operators, Previous: Variable Assignment, Index: Index

In order to allow for checking and testing of values the language supports the conditional.
if ([condition])
{
then
} else {
optional else
};
if ([condition]) then;
Generally there are two program conditional structures - the first as shown above, with the optional else branch. The second can be used for conciceness if the then is only one program statement. Notice how the conditional brace MUST be followed by sequential composition. On this page we have used the { } braces, the language also supports braces of the form ( ). These are identical and can be interchanged throught the code depending on your prefered style.

## Conditional Operators

Operator | Semantics
--- | ---
== | Equal To
= | Equal to for strings
!= | Not Equal To
< | Smaller than
<= | Smaller or equal to
> | Greater than
>= | Greater or equal to

## Examples

if (a==b)
{
print["YES\n"];
} else {
print["NO\n"];
};
if (y>x) print["XYZ"];
if (p=="hello") {p:="empty"; print["OK"];};
The example above is quite self explanatry, so we wont explain it.
Last Modified: August 2008