CONFIG SUBMODE/de
Contents |
= (**COPIED FROM ENGLISH PAGE**) === Action
This option sets how the compiler deals with Subs, Functions and Declarations.
Syntax
CONFIG SUBMODE = NEW|OLD
Remarks
When the SUBMODE option is not configured, the default 'OLD' will be used.
This is the old mode used in versions up to 2070.
This old mode demands that you DECLARE a function or sub, before you call it.
It also binds in the sub/function at the same location as in your code.
When working with $include files, this requires that you put the $include file at the end of your code, and that you put an $include file at the start of your code. Or that you use a GOTO to jump over the Sub/Function code.
When you use CONFIG SUBMODE=NEW, most behaviour is changed :
- there is no need to DECLARE a sub/function before you call it. But, the actual sub/function code must be placed before the actual call!
- only the used sub/functions are included
- the sub/function code is placed after the main program. this is something you do not need to worry about.
- you can $include the modules without a GOTO to jump over the code.
- sub/functions behave like macro's : only when used they are included
See also
DECLARE SUB, SUB, DECLARE FUNCTION , CALL
Example
$regfile = "m88def.dat" $crystal = 8000000 config submode=new declare sub test1() ' not required sub test2() ' this sub is not used and will not be compiled print "test2" end sub function myfunc() as byte ' called from test1 myfunc = 1 end function sub test1() print "test1" print myfunc() ' uses myfunc end sub print "test" test1 ' call test1 end '12
Languages | English • Deutsch |
---|