Include -3, Include – Rockwell Automation 1747-PBASE BASIC Development Software Programming Manual User Manual

Page 75

Advertising
background image

Publication 1746-PM001A-US-P

Writing Programs Using the BASIC Development Language 6-3

Syntax:{ }

Syntax: REM

Example:
Before translation:

After translation:

{This is a comment}

0 REM ...

REM THIS IS A REMARK

10 REM THIS IS A REMARK

Examples of illegal comments:

{$ comment}

{{comment}}

For example, upon translating the FIRST program of chapter 2 you would get
something like:

0 REM BTRAN V X.XX C:\ABBASIC\BAS\FIRST.BDL, 06-12-91 06:35pm

Include

The Include directive tells the translator to load another source code file into the
current program. This method of file inclusion allows you to frequently used
routines in many different programs without re-entering any code or having to edit
line numbers. The included file can contain any combination of program
statements and translator directives.

Syntax:

{$I [filename.ext]}

Example:
Before translation:

After translation:

REM INCLUDE EXAMPLE

0 REM ...

{$I FIRST.BDL}

10 REM INCLUDE EXAMPLE

20 FOR X=1 TO 100

30 A=X*2

40 P. A

50 NEXT X

60 END

IMPORTANT

If a dollar sign immediately follows the left curly bracket, it is not
interpreted as a comment. Comments are also not allowed inside
of comments.

IMPORTANT

Remarks (line zero) will be created by the 1747–PBASE
Translator for each .BDL program that is translated (indicated in
this manual by: 0

REM ...)

. This remark contains the translator’s

filename (BTRAN), followed by its revision number, path and
name of the program being translated, and date and time.

Advertising