Using Functions Using Functions eV+ provides you with a wide variety of predefined functions for performing string, mathematical, and general system parameter manipulation. In most cases, you must provide the data that is input to a function. The function then returns a value based on a specific operation on that data. Functions can be used anywhere a value or expression would be used. Variable Assignment Using Functions The instruction: $curr_time = $TIME() puts the current system time into the variable $curr_time. This is an example of a function that does not require any input data. The instruction: var_root = SQRT(x) puts the square root of the value x into var_root.
X is not changed by the function. Functions Used in Expressions A function can be used wherever an expression can be used (as long as the data type returned by the function is the correct type). The instruction: IF LEN($some_string) > 12 THEN results in the Boolean expression being true if the string $some_string has more than 12 characters. The instruction: array_var = some_array[VAL($x)] results in array_var having the same value as the array cell $x. (VAL converts a string to a real.) Functions as Arguments to a Function In most cases, the values passed to a function are not changed.
This not only protects the variables you use as arguments to a function, but also allows you to use a function as an argument to a function (so long as the data type returned is the type expected by the function). The following example results in i having the absolute value of x. (i = D(-22) = 2). i = SQRT(SQR(x)) eV+Language User's Guide, v2.x, 18318-000 Rev A Page 81