Please enable JavaScript to view this site.

ESL Documentation

Navigation: ESL Documentation > ESL Programmers Guide > ESL Language Elements

Expressions, Operators, and Operands

Scroll Prev Top Next More

An expression is a combination of operands and operators that produces an integer, floating point, string, or boolean value as a result. One can be specified wherever a value is required.

 

Valid operators are arithmetic, relational, or boolean. You can specify operators in all of these categories in a single expression.

 

Valid operands are literals, constants, variables, and built-in functions. You must specify operands that are either of the type required for the particular operator, or that ESL can convert to the correct type using Type Conversion. For example, if you specify multiplication (the operator *), the operands must be integers or floating point numbers, such as:

 

(A * 56)

 

where A is an integer constant or variable. If you specify an operand that ESL cannot convert, an error message is produced at compile time. For example:

 

(true = 1)    # Integers cannot be converted to booleans. 

 

All expressions must be enclosed in parentheses. You can specify expressions wherever a compile-time value is required; if the expression contains one or more variables, the initial values of the variables are evaluated at compile time.

 

The simplest expression is a literal, such as (-10). The name of a variable or constant can also be considered an expression, when it is enclosed in parentheses.

 

In compound expressions, the operands are themselves expressions; for example:

 

(Width  = ((Height / Xfactor) + 8) * 5)

 

Note that the final value of this expression is true or false, and that the contents of the variable Width are not changed since it is just part of an "is equal" expression.