March 2000
Intermediate to advanced
576 pages
18h 13m
English
$IfOpt Compiler Directive
{$IfOpt Switch+}
...
{$Endif}
{$IfOpt Switch-}
...
{$Endif}Local
$IfOpt
is similar
to $IfDef, except that it tests the state of a
switch compiler directive. Only single-letter switches can be tested.
If the directive is enabled, the
Switch
+ test is True
and Switch
- is False.
If the directive is disabled,
Switch
+ is False and
Switch
- is
True.
See $IfDef for more information.
// Temporarily disable Range checks, then revert to the original switch.
{$IfOpt R+}
{$define RangeChecks}
{$else}
{$undef RangeChecks}
{$endif}
{$R-}
... // code that requires range checks be disabled
{$ifdef RangeChecks}
{$R+}
{$endif}| $Define Compiler Directive, $Else Compiler Directive, $Endif Compiler Directive, $IfDef Compiler Directive, $IfNDef Compiler Directive, $Undef Compiler Directive |
Read now
Unlock full access