Table of Contents

TatCustomScripter.OptionExplicit Property

Indicates whether variables must be explicitly declared before use in scripts.

Remarks

When OptionExplicit is true, you must declare variables inside script. When OptionExplicit is false, you don't need to declare variables, just initializing a variable will automatically declare it.

begin MyNewVar := 0; end;

the above code is valid when OptionExplicit is false. If it is set to true, a compilation error will be raised, and you be explicity declare the variable.

var MyNewVar: integer; begin MyNewVar := 0; end;

Even when OptionExplicit is false, you cannot use a variable before it is initialized. The following code is invalid in any situation.

begin ShowMessage(IntToStr(MyNewVar)); //Error, MyNewVar not declared/initialized end;

OptionExplicit is false by default in TatPascalScripter and TatBasicScripter components, for backward compatibility purposes, but it is true by default in the new TatScripter component.

Syntax

Unit: atScript

property TatCustomScripter.OptionExplicit: Boolean

See also