DelphiScript - Set Operators

Applies to TestComplete 14.72, last modified on January 20, 2021

There are some differences in the use of set operators in DelphiScript and Delphi. In DelphiScript the [...] set operator is not supported. You should use the MkSet function instead. For instance:


var ppOne, ppTwo;
var z;
ppOne : =1;
ppTwo := 2;
z := MkSet(ppOne, ppTwo);

In this example, the MkSet function puts 1 into the second and third bits since the first bit has index 0. So, the value of the z variable is 6 (but not 3).

Instead of the in operator, you should use the InSet function, for example:


if InSet(ppOne, z) then

See Checking TDBGrid Options From Scripts.

As in Standard Pascal or Object Pascal, sets are implemented as collections of bits. However, because of the implicit type conversions of OLEVariant variables, the resulting sets are treated as integers. Arithmetic operators, +, -, *, <= and >= , cannot be used as set operators. Logical operators must be used in their place. For example:


z := ppOne + ppTwo;

should be changed to


z := ppOne or ppTwo;

Note: The mentioned functions: MkSet and InSet work not only in DelphiScript but in all supported languages. For more information see Functions Added to All Scripting Languages.

See Also

DelphiScript Description

Highlight search results