You are here: Core Reference > Coding > Logic > Expressions

Expressions

Expressions are calculations or evaluations that are defined within Statements. They can use one or more operators, functions, and variables.

Each ST expression produces a value which can be wither a built-in data type (see Built-In Data Types) or a derived data type (see Derived Data Types). These values can be used within a program or can be written to items in the database.

An expression can be simple or complex. A simple expression includes a single calculation, for example:

y + 10

or a Boolean expression such as:

x = y

A complex expression contains several calculations that are used to produce a value, for example:

(x + y) * 2

Expressions are evaluated in order. The precedence of the operators and other expressions in the statement determines when an expression is evaluated. Expressions are evaluated in this order:

  1. Parenthesized expressions, such as:

    (x + y) * 2

  2. Function calls, such as:

    COS(x)

    Where COS is the function being called, and x is the argument.

Within this order, operators are evaluated in precedence order (see Operators). For example, a parenthesized expression with negation will be evaluated before a parenthesized expression with inequality.

NOTE: For Boolean operators, the expression is evaluated up to the part of the statement at which the value can be determined.


ClearSCADA 2015 R2