DelphiScript - If, Case and Loop Operations

Applies to TestComplete 15.10, last modified on December 15, 2021

In DelphiScript you can use the if operator in the same way as in Delphi. There are no restrictions on it. The same is true for the loop operators: for, while and repeat...until.

The case operator has a bit wider functionality than in Delphi. Blessedly, it can be used for any types including strings. For instance, the following code is correct:

DelphiScript

case Sys.Desktop.ActiveWindow.WndCaption of
  'Find' : Log.Message('The Find dialog');
  'Replace' : Log.Message('The Replace dialog');
else
  Log.Warning('Unexpected window');
end;

See Also

DelphiScript Description

Highlight search results