Microsoft KB Archive/37425

From BetaArchive Wiki
Knowledge Base


REM $INCLUDE Versus MERGE in QuickBASIC Compiler & Interpreter

Article ID: 37425

Article Last Modified on 1/8/2003



APPLIES TO

  • Microsoft QuickBasic Compiler for Macintosh 1.0



This article was previously published under Q37425

SUMMARY

In Microsoft QuickBASIC for the Apple Macintosh, the REM $INCLUDE metacommand is only used in the compiler (as are other metacommands) and is ignored in the interpreter environment. Placing a REM $INCLUDE metacommand in your source file makes the compiler insert an external text file containing additional program code at compile time.

The MERGE command acts similar to the $INCLUDE metacommand; however, MERGE only works within the QuickBASIC interpreter environment. The MERGE command appends a text file to the end of the current source file in memory.

MORE INFORMATION

Using a combination of the $INCLUDE and $IGNORE metacommands, you can write a program source file that is compatible as both a compiled and interpreted program.

You can use the $INCLUDE metacommand to bring in compiler-specific code. The $IGNORE ON and $IGNORE OFF metacommands can be used to set aside code for the interpreter only. See the example code skeleton below.

The following is a code example:

REM $INCLUDE: 'text file for compiler only'
REM $IGNORE ON
PRINT "This is only used in interpreter; compiler ignores this line.
REM $IGNORE OFF
PRINT "This is used by both compiler and interpreter."
END
                

Below is the $INCLUDE file, called 'text file for compiler only':

PRINT "This line is only included and executed in the compiled program."


Additional query words: MQuickB

Keywords: KB37425