====== If conditional expression ====== ==== Description ==== Same as a single-line If statement, except that the entire statement is evaluated as an expression, leaving only one of two values. ==== Syntax ==== **If** //test// **Then** //true_expression// [**Else** //false_expression//] - OR - **If** //test// **Else** //false_expression// ==== Parameters ==== The conditional If expression has the following parameters. ^Parameter^Description^ |//Test//|An expression that equates to a Boolean value - true (non-zero) or false (zero).| |//true_expression, false_expression//|The conditional-expression If allows the test for a condition where a statement cannot be used (in other words, where only a single line is available, and it must evaluate as an expression). It returns one of two values, depending on the result of the test expression.| When test is true, then the value of //true_expression// is the result of the If expression. When the test is false (0 or null) the value of the //false_expression// is the result of the If expression. For example:\\ \\ @ANS = If {CHANGED} Then "YES" Else "NO"\\ \\ The dictionary record that contains the above code is used in a report that shows when a record has been changed. If the CHANGED field is not empty and contains anything other than a 0, then "YES" will be printed in the report.\\ \\ The conditional-expression If must be written on a single line. The Then and Else clauses may only contain an expression.\\ ==== Example ==== Function MAX (X,Y) MAX=If X>Y Then X Else Y Return MAX