#IF

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > Script structure > Conditional parsing statements >

#IF

 

Description

 

Define sections of source code to be parsed or ignored, depending on a certain condition.

 

#IF, #ELSE, #ELSEIF, #ENDIF.

 

These keywords are often, in other languages, referred to as conditional compilation statements and are mainly used to include in source files pieces of code under certain circumstances.

 

Now you can use this functionality also in thinBasic but mainly for compatibility purposes in order to include external Basic sources.

thinBasic is an interpreter so there is no reason the execute a conditional "compilation" phase (usually performed by multi step compilers) because all is done on the fly by the parsing engine. a simple IF statement does the same.

 

Syntax

 

#IF {numeric expression}

 

 {statements}

 

[#ELSEIF {numeric expression}

 

 {statements}]

 

[#ELSE

 

 {statements}]

 

#ENDIF

 

Returns

 

None

 

Parameters

 

Remarks

 

Restrictions

 

See also

 

Examples