Navigation:  thinBasic language > Script structure > Conditional parsing statements >

#IF

Previous pageReturn to chapter overviewNext page

 

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

 

 

 

© 2004-2008 thinBasic. All rights reserved. Version 1.7.0.0 Web Site: http://www.thinbasic.com