Real and Integer Data Types Numeric Expressions In almost all situations where a numeric value of a variable can be used, a numeric expression can also be used. The following examples all result in x having the same value. x = 3 x = 6/2 x = SQRT(9) x = SQR(2) - 1 x = 9 MOD 6 Logical Expressions eV+ does not have a specific logical (Boolean) data type. Any numeric value, variable, or expression can be used as a logical data type. eV+ considers 0 to be false and any other value to be true. Logical Constants There are four logical constants, TRUE and ON that will resolve to -1, and FALSE and OFF that will resolve to 0. These constants can be used anywhere that a Boolean expression is expected.
A logical value, variable, or expression can be used anywhere that a decision is required. In this example, an input signal is tested. If the signal is on (high) the variable dio.sample is given the value true, and the IF clause executes. Otherwise, the ELSE clause executes:
dio.sample = SIG(1001) IF dio.sample THEN ; Steps to take when signal is on (high) ELSE ; Steps to take when signal is off (low) END Since a logical expression can be used in place of a logical variable, the first two lines of this example could be combined to IF SIG(1001) THEN Functions That Operate on Numeric Data For a summary of eV+ functions that operate on numeric data, see the section Numeric Value Functions on page 85. eV+Language User's Guide, v2.x, 18318-000 Rev A Page 43