if condition then true_statement else false_statement;
condition is a boolean expression that evaluates to true xor false. true_statement is executed if condition evaluates to true. false_statement is executed if condition evaluates to false. A compile-time error occurs if the type of condition does not evaluate to a boolean value.
Multiple statements in if then branch
if boolean_condition then begin statement_zero; statement_one; statement_two; end;
- Official documentation: Reference guide: § “The If..then..else statement”
- IF, Tao Yue, Object Pascal Introduction
- If statement and semicolon