Name

$Define Compiler Directive

Syntax

{$Define Name}

Scope

File

Description

The $Define directive defines Name as a conditional symbol, for use in conditional compilation. Subsequent uses of the $IfDef directive for Name test positive. You can define the same name more than once in a file. See the $IfDef for an example. Conditional symbol names are not case sensitive.

Unlike macro definitions in C and C++, a definition in Delphi is a simple flag. A name is defined or not defined. Test whether a name is defined by using the $IfDef and $IfNDef compiler directives. You can use the same name as a conditional symbol and as an identifier in the same file.

See Also

$Else Compiler Directive, $Endif Compiler Directive, $IfDef Compiler Directive, $IfNDef Compiler Directive, $IfOpt Compiler Directive, $Undef Compiler Directive

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.