Sign in Join
Wiki copytemporary

Revision 1 of 2, by WikiArchive on 11-4-2026. The page as it is now.

If/fi

If avainsana edeltää ehtoa jota seurattava [[Then|then]] ja lause (statement). Siinä voi olla myös [[Else/fi|else]] lause.

If then

pascal
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/fi|begin]] … [[End/fi|end]] lohkoon (koottu lause).

pascal
if boolean_condition then
    begin
        statement_zero;
        statement_one;
        statement_two;
    end;

Katso myös

Keywords: begin — do — else — end — for — if — repeat — then — until — while


From the Free Pascal wiki, page "If/fi", as the Internet Archive kept it on 2025-03-22. 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.