The XCSB if statement is a conditional construct designed to
conditionally execute a sequence of statements. The general format of the
if statement is:
if cond_expr then
true_statement_list
else
false_statement_list
endif
however the false_statement_list is optional and if omited the
else can also be omited providing the alternate format:
if cond_expr then
true_statement_list
endif
where:
cond_expr is the expression that is executed to determin
which of the true_statement_list or the false_statement_list should be
executed. If cond_expr produces a non-zero result the
true_statement_list is executed, if cond_expr produces a
zero result and a false_statement_list is present then the
false_statement_list is executed
When checking for multiple conditions using a chain of if statements
the code can start looking untidy very quickly. Consider
if cond_1 then
statement_list_1
else
if cond_2 then
statement_list_2
else
if cond_3 then
statement_list_3
else
false_statement_list
endif
endif
endif
XCSB allows a special form of the chained if statement which
looks like this:
if cond_1 then
statement_list_1
else if cond_2 then
statement_list_2
else if cond_3 then
statement_list_3
else
false_statement_list
endif
This is the only time another statement is allowed on the same line as
the else statement