Expressions and Operators

www.kxcad.net Home > Electronic Index > Altium(Protel) Index


Your Ad Here

An expression is a valid combination of constants, variables, literal values, operators and function results. Expressions are used to determine the value to assign to a variable, to compute the parameter of a function, or to test for a condition. Expressions can include function calls.

Delphi Script has a number of logical, arithmetic, Boolean and relational operators. Since these operators are grouped by the order of precedence which is different to the precedence orders used by Basic, C etc. For example, the AND and OR operators have precedence compared to the relational one.

For example if you write a<b and c<d, the Delphi Script will do the AND operation first, resulting in an error. To fix this problem, you have to enclose each of the < expression in parentheses: (a<b) and (c<d);

These operators listed below are the operators supported by Delphi Script.

Operators grouped by precedence

Unary operators have the highest precedence

Not

Boolean or bitwise NOT.

Multiplicative and Bitwise Operators

*

Arithmetic multiplication.

/

Floating point division.

div

Integer division.

mod

modulus (reminder of integer division).

and

Boolean or bitwise AND.

shl

Bitwise left shift.

shr

Bitwise right shift.

Additive Operators

+

Arithmetic addition, string concatenation.

-

Arithmetic subtraction.

or

Boolean or bitwise OR

xor

Boolean or bitwise EXCLUSIVE OR.

Relational and Comparison Operators (lowest precedence)

=

Test whether equal or not.

<>

Test whether not equal or not.

<

Test whether less than or not.

>

Test whether greater than or not.

<=

Test whether less than or equal to or not.

>=

Test whether greater than or equal to or not.

Note

The ^ and @ operators are not supported by Delphi Script.

See also

Delphi Script functions

DelphiScript Keywords Reference

DelphiScript Extensions Reference

Your Ad Here