### 5.2.9 if

`Syntax:`
  `if (` boolean_expression `)` true_block
  `if (` boolean_expression `)` true_block `else` false_block
`Purpose:`
  executes true_block if the boolean condition is true. If the `if` statement is followed by an `else` statement and the boolean condition is false, then false_block is executed.
`Example:`

      int i = 9;
      matrix m[i][i];
      if (i > 5 and typeof(m) == "matrix")
      {
        m[i][i] = i;
      }

See Control structures; boolean expressions; break; else.

User manual for Singular version 4.4.1, 2025, generated by texi2html.