Free Pascal Links
Free Pascal
Free Pascal Wiki
Lazarus IDE
Lazarus Forum
forum.lazarus.freepascal.org/index.php?action=forum
Projects Using Lazarus
wiki.freepascal.org/Projects_using_Lazarus
If statements are used to make decisions.
The If Statement Expression Signs
< Less Than
<= Less Than or Equal To
> Greater Than
>= Greater Than or Equal To
= Equal To
<> Not Equal To
The Syntax for the If Statement
if <condition> then
begin
do something;
end;
If Statement Example
if 5 > 2 then
begin
writeln(‘5 Is Greater Than 2’);
end;
The Output
5 Is Greater Than 2
Another If Statement
if 5 < 2 then
begin
writeln(‘5 Is Less Than 2’);
end;
There will not be any output because 5 is not less than 2.
If statements can have multiple conditions. This is referred to as if - else statements.
Syntax for the If - Else Statement
If <condition>
begin
do something;
end
else if <condition>
begin
do something;
end
else
begin
do something;
end;
Code Download
FPProgT5.zip
Free Pascal
Free Pascal Wiki
Lazarus IDE
Lazarus Forum
forum.lazarus.freepascal.org/index.php?action=forum
Projects Using Lazarus
wiki.freepascal.org/Projects_using_Lazarus