next up previous index
Next: Expressions Up: Statements Previous: Call statement

Assertions

AssertStatement ::= ASSERT Expression

  Assertions are statements that ensure that a given condition is fulfilled. They are ways of improving the quality and the readability of the code, by explicitly stating information that would otherwise be implicit, or informally described in comments.

When executing an assertion, RainCode evaluates the attached expression. If it evaluates to TRUE, no action is taken. If it evaluates to FALSE, depending on the value of the FatalAssertions configuration variable , RainCode aborts the execution of the current script, or simply issues a comprehensive error message on the standard output stream. If it does not evaluate to a boolean value, the script aborts with an error message indicating an invalid type.