What is a conditional (overview)?
Sometimes we need our Maple code to decide what to compute based on the value of an expression.
Such
conditionals
(decision-making) are achieved by an
IF-THEN-ELSE-FI
statement:
if test_expression then value_if_true else value_if_false fi
The
test_expression
is evaluated. If that value is true, then the value of the entire "
if
" is the value of the
value_if_true
expression, otherwise it is the value of
value_if_false
. The final
fi
("if" spelled backwards) signals Maple that we've reached the end of the
if
statement. Note that
test_expression,
value_if_true
and
value_if_false
are not actual things that you type in; they stand for arbitrary Maple expressions.