If/fi
If avainsana edeltää ehtoa jota seurattava then ja lause (statement). Siinä voi olla myös else lause.
If then
if condition
then true_statement
else false_statement;Yllä olevan condition on boolean tyyppinen ehto joka tuottaa true tai false arvon. Koodissa siirrytään true_statement jos condition tuottaa arvon true. Koodissa siirrytään false_statement suoritukseen jos condition tuottaa arvon false. Käännösaikainen virhe syntyy jos condition ei tuota boolean tyyppistä arvoa.
Monia lauseita if then haarassa
Jos tarvitaan kahta tai useampaa lausetta true_statement tai false_statement niin se saadaan kokoamalla ne begin…end lohkoon (koottu lause).
if boolean_condition then
begin
statement_zero;
statement_one;
statement_two;
end;Katso myös
- Official documentation: Reference guide: § “The
If..then..elsestatement” - IF, Tao Yue, Basic Pascal Introduction
- If lause ja puolipiste
From the Free Pascal wiki, page "If/fi", as it stood on 2023-01-25 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.