Previous topic |
Next topic |
Ada Home Page |
Index
If-then statements
A basic if-then statement is used when the
choice is whether to take an action or not; there is no
alternative action.
Statement Form
statement_before;
if test then
statements(s)_1;
end if;
statement_after;
Statement semantics
The test is an expression evaluating to TRUE or FALSE
- called a BOOLEAN expression
- simplest test expression is a relational comparison
value_1 relational_operator value_2
where the relational operators are one of:
= /= < > <= >=
An example program shows the
use of an if-then statement to decide whether or not to print a message.
Previous topic |
Next topic |
Ada Home Page |
Index
c-lokan@adfa.oz.au / 13 Feb 96