Delphi Quick Syntax Reference by John Kouraklis

Delphi Quick Syntax Reference by John Kouraklis

Author:John Kouraklis
Language: eng
Format: epub
ISBN: 9781484261125
Publisher: Apress


Conditional Statements

Conditional statements allow the execution of code when a statement (or condition) is true, following the usual pattern we saw in while and repeat statements. In Delphi, conditional statements take the form of if or case statements.

If Statement

In its simplest form, If statements follow the natural language: if something is valid, then this happens.var

grade: integer;

begin

grade:=10;

if grade > 5 then

Writeln('Greater than 5');

end.

In this case, the expression grade > 5 is true, and the next line is executed. If executes only the next line of code; thus, if more lines need to run when the expression is valid, you need to use a begin..end block as in the following example:if grade > 5 then

begin

writeln('Greater than 5');

writeln('You pass');

end;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.