|
Decision making in Delphi is determined
using IF and CASE statements. Below are some examples of coding frameworks:
Basic IF statement
IF <condition(s)> THEN
BEGIN
<statements>
END;
IF Statement with an ELSE

IF <condition(s)> THEN
BEGIN
<statements>
END
ELSE {If the top condition is not met then…}
BEGIN
<statements>
END;
IF <condition(s)> THEN
BEGIN
<statements>
END
ELSE
IF <condition(s)> THEN
BEGIN
<statements>
END
ELSE {If the top conditions are not met then…}
BEGIN
<statements>
END;
Additional logical operators can also be added: AND, OR, NOT (use brackets
around conditions)
CASE statement
CASE <selection statement> OF
<value1> := <statement(s)>;
<value2> := <statement(s)>;
<value3> := <statement(s)>;
ELSE
<statement(s)>
END;
|