Find more freelance jobs
|
46
and a variable `decimal point' symbol (a period or a comma) depending on the applicable currency key. You can extend the IF command with the ELSE command to allow text lines to be specified that you want to print in case the condition is false. If the condition is true, the text lines enclosed by the IF and ELSE commands are formatted; otherwise the text lines enclosed by the ELSE and ENDIF commands are formatted. Syntax: /: IF condition : /: ELSE : /: ENDIF The ELSEIF command allows you to specify multiple cases. Syntax: /: IF condition : /: ELSEIF condition : /: ELSE : /: ENDIF You can use any number of ELSEIF commands within one compound IF.. ENDIF control command. The use of an ELSE command is then optional. · You must not extend a condition over more than one line. Both the IF or ELSEIF command and the attached condition must be completely contained within a single line. · You can nest IF commands. · You must terminate an IF command with an ENDIF command. If you forget this, there will be no more output following the IF command if the condition is false. · If a syntax error occurs in the interpretation of this command, then the command is not executed. This may have an unexpected effect on the subsequent text output. For example, if the IF statement is incorrect, then all following ELSEIF and ELSE commands will be ignored, since the opening IF command is `missing'. This will cause all the text lines attached to the ELSEIF and ELSE commands to be printed. 6.16 Finding a Match: CASE The CASE command covers a special case of the multiple case IF command. Rather than allowing an arbitrary condition to be tested in each of the individual cases (as in the general multiple case IF command), the CASE command allows a given symbol to be tested against specific values until a matching value is found. Syntax: /: CASE symbol /: WHEN value1 : /: WHEN value2 : /: WHEN valuen : /: WHEN OTHERS. : /: ENDCASE The symbol in the CASE line is formatted. If its value is found in one of the WHEN lines, then the text lines following this WHEN line are printed. If no matching value is found then the text lines enclosed by the WHEN OTHERS line and the ENDCASE command are printed. The WHEN OTHERS section is optional. As with the IF command, the comparison is always performed on literal values. Previous Page|Next Page |