if statements

Top  Previous  Next

if statements

 

There are two forms of if statement: if...then and the if...then...else. Like normal pascal, if the if expression is true, the statement (or block) is executed. If there is else part and expression is false, statement (or block) after else is execute.

 

Examples:

 

if J <> 0 then Result := I/J;

 

if J = 0 then Exit else Result := I/J;

 

if J <> 0 then

begin

 Result := I/J;

 Count := Count + 1;

end else

 Done := True;