(   )

Operator - force the evaluation order in a complex expression.

Remarks

Parentheses are used in STClosed "Structured text" A high-level language that is block structured and syntactically resembles Pascal and ILClosed "Instruction list" This is a low-level language and resembles assembly language for changing the default evaluation order of various operations within a complex expression. For instance, the default evaluation of "2 * 3 + 4" expression in ST language gives a result of 10 as "*" operator has highest priority. Changing the expression as "2 * ( 3 + 4 )" gives a result of 14. Parentheses can be nested in a complex expression.

Below is the default evaluation order for ST language operations (1rst is highest priority):

Unary operators - NOT
Multiply/Divide * /
Add/Subtract + -
Comparisons < > <= >= = <>
Boolean And & AND
Boolean Or OR
Exclusive OR XOR

In IL language, the default order is the sequence of instructions. Each new instruction modifies the current result sequentially. In IL language, the opening parenthesis "(" is written between the instruction and its operand. The closing parenthesis ")" must be written alone as an instruction without operand.

ST Language

Q := (IN1 + (IN2 / IN 3)) * IN4;

FBD Language

Not available

FFLD Language

Not available

IL Language

Op1: FFLD(  IN1
     ADD( IN2
     MUL  IN3
     )
     SUB  IN4
     )
     ST   Q    (* Q is: (IN1 + (IN2 * IN3) - IN4) *)

See also

Assignment