Expressions

<< Click to Display Table of Contents >>

Navigation:  Script Language >

Expressions

Following operations are allowed in expressions

* , / , and , + , - , or , <> , >=, <= , = , > , < , div , mod , xor , shl , shr, ^, @, is, not, in, not in

 

"in" operation can be used with arrays:

  if s in ['abc', 'def'] then ...

 

sets

    if n in [1..10] then

 

and classes with enumerators (see Registering for-in enumerators)

Example:

 

  L := TStringList.Create();

  L.Add('abc');

  L.Add('def');

  if s in L then ...

 

is operator supports simple types:

  if k is string then ...;

 

Compound assignment operators:

 

  k += 2;
  k -= 2;
  k *= 2;

 

Ternary operator:

 

a := if b = 1 then 2 else 3;

 

case operator:

 

a := case b of 1: 2; 1+1: 4-1; else 4 end;