Futurebasic/Language/Reference/include

INCLUDE

edit

Statement

edit

Appearance Standard Console

Syntax

edit

INCLUDE {"<path>"|alisResID}

Description

edit

When the compiler encounters an INCLUDE statement, it looks for a text file indicated by <path> or alisResID, reads the FB statements contained in that file, and effectively inserts those statements into the source code stream. <path> can be either a full or partial pathname; if you use a partial pathname, it's assumed to be relative to the folder containing the "parent" source file (i.e., the source file that has the INCLUDE statement). <path> may refer either to a text file, or to an alias file whose target is a text file. alisResID must be the resource ID number of an "alis" resource whose target is a text file. This resource should exist in the resource fork of the "parent" source file. INCLUDE files may be "nested"; that is, an INCLUDE'd file may contain references to other INCLUDE files. Example: Suppose we create a file "Assign.INCL" which contains the following lines of text: a = 3 b = 7 Now suppose we write a program like this: DIM x(100) INCLUDE "Assign.INCL" c = a + b When we compile this program, the result will be identical to this: DIM x(100) a = 3 b = 7 c = a + b Note: FutureBasic's Project Manager is generally a more convenient way to combine the source code from several different files. However, there are some advantages to using the INCLUDE statement, such as the ability to conditionally include files (see COMPILE LONG IF). FB does not allow a given file to be included more than once in the source stream. If a second INCLUDE reference is made to a given file, that INCLUDE statement will be ignored.

See Also

edit

COMPILE, LONG, IF