A conditional statement, or simply condition, is a comparison that must be either TRUE or FALSE.
Rules:
- Each conditional statement compares two values of the same data type - these may be integers (int), decimals (real), or combinations of characters (string).
- A comparison operator must be used between each pair of values.
- Multiple comparisons are possible using the logical operators, also called the boolean operators.
Format:
<value1> <comparison operator> <value2>
Sample Code:
var a : int
var b: int
put "What is a? "..
get a
put "What is b?"..
get b
if a = b then
put "a and b are the same"
else
put "a and b are not the same"
end if
Comments (0)
You don't have permission to comment on this page.