Difference between revisions of "IFDEF"
Yvonne.milne (Talk | contribs) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Compiler directives to allow inclusion or exclusion of source code based on a compile-time constant | Compiler directives to allow inclusion or exclusion of source code based on a compile-time constant | ||
− | |||
==Syntax== | ==Syntax== | ||
Line 13: | Line 12: | ||
#ENDIF | #ENDIF | ||
− | |||
==See Also== | ==See Also== | ||
[[COMPILE]], [[DEFINE]], [[DO]], [[DO CASE]], [[IF]], [[SET COMPILE]], [[SET DEVELOPMENT]] | [[COMPILE]], [[DEFINE]], [[DO]], [[DO CASE]], [[IF]], [[SET COMPILE]], [[SET DEVELOPMENT]] | ||
− | |||
==Description== | ==Description== | ||
The #IFDEF compiler directive can be used to allow inclusion or exclusion of source code based on the existence of a compile-time constant. The constant, <constant>, is defined using the #DEFINE directive. | The #IFDEF compiler directive can be used to allow inclusion or exclusion of source code based on the existence of a compile-time constant. The constant, <constant>, is defined using the #DEFINE directive. | ||
− | At compile time, the compiler checks if the <constant> is defined. If it is defined, the <statements1> that follow are included in the compiled program file | + | At compile time, the compiler checks if the <constant> is defined. If it is defined, the <statements1> that follow are included in the compiled program file. If the <constant> is not defined, the <statements1> are excluded. If the <constant> is not defined and there is a #ELSE directive specified, the <statements2> following the #ELSE directive are included in the compiled program file. |
This directive can only be used in compiled programs. | This directive can only be used in compiled programs. | ||
− | |||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | </code> | ||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Commands]] | [[Category:Commands]] | ||
− | |||
− |
Latest revision as of 12:38, 7 March 2013
Contents
Purpose
Compiler directives to allow inclusion or exclusion of source code based on a compile-time constant
Syntax
#IFDEF <constant>
[<statements1>]
[#ELSE]
[<statements2>]
#ENDIF
See Also
COMPILE, DEFINE, DO, DO CASE, IF, SET COMPILE, SET DEVELOPMENT
Description
The #IFDEF compiler directive can be used to allow inclusion or exclusion of source code based on the existence of a compile-time constant. The constant, <constant>, is defined using the #DEFINE directive. At compile time, the compiler checks if the <constant> is defined. If it is defined, the <statements1> that follow are included in the compiled program file. If the <constant> is not defined, the <statements1> are excluded. If the <constant> is not defined and there is a #ELSE directive specified, the <statements2> following the #ELSE directive are included in the compiled program file.
This directive can only be used in compiled programs.