If

From Mesham
(Redirected from Conditional)
Jump to navigationJump to search

Syntax

if (condition)
{
then body
} else {
else body
};

Semantics

Will evaluate the condition and, if true will execute the code in the then body. Optionally, if the condition is false then the code in the else body will be executed if this has been supplied by the programmer.

Example

#include <io>
function void main() {
   if (a==b) {
      print("Equal");
   };
};

In this code example two variables a and b are tested for equality. If equal then the message will be displayed. As no else section has been specified then no specific behaviour will be adopted if they are unequal.

Since: Version 0.41b