4.3 Conditional clauses

If a conditional clause is still clear and not of excessive length when written on a single line, just do it.

Start the enquiry clause in the if-part of a conditional clause right after the if symbol, not in the next line.

The serial clauses in the then- and if-parts of the conditional clause shall be indented five positions right, which is the length of both the then and else symbols plus one.

The first declaration or unit in the then- and if-parts shall be placed in the same line than the then and else symbols, respectively.

Place the fi closing symbol in its own line, with the same indentation level than the matching if. The exception to this rule is when the conditional clause has no else-part and the then-part spans for a single line that is not too long. In that case, place the fi in the same line than then.

Examples:

{ Very small conditional clause in a single line }
if idx < 0 then fatal("invalid idx") fi

{ Short conditional-clause with `fi' in the same line
  than `then' }
if argc /= 3
then puts("expected two arguments'n") fi

{ A conditional-clause that spans several lines }
if a > 10
then puts("truncating");
     a := 10
fi