if / then / else
Executes code based on a condition.
Syntax
if condition then ... else ...;
Description
NO semicolon is placed BEFORE else. begin..end is used for multiple lines. Equality is =, inequality is <>.
Example
Loading editor…
Expected output
Passed
When to use?
Flow branching.
Common mistakes
- ⚠️ do not put ; before else: writeln('Gecti') else ... (no ; on the first line).