Multiple Statements on a Line

From CometWiki

Jump to: navigation, search

Multiple Statements on a Line

One of the many convenient programming features of Internet Basic is the ability to write more than one source statement on the same editor line. A special character is required for this purpose; the character is the ampersand (&). When used on a source program line, the ampersand permits multiple statements to be written on a single line. There is no limit to the number of statements that can appear on one source line (other than the editor's line length limitation).

Note: The ampersand character can be used in all divisions of an Internet Basic source program.

Also see Underscore and ampersand.

Example 1:

  LET A=10 & LET B=20 & LET C=30

This example shows how three assignment statements can be written on a single source line. Example 2:

  LENGTH 8.2 & LOCAL CRLIMIT

This example shows how two Data Division statements (LENGTH and LOCAL) can be written on a single source line. Example 3:

  IF ARTOTAL GT CREDIT THEN PRINT (0) "OVER THE LIMIT" & GOTO 1000

This example shows how multiple statements (PRINT and GOTO) can be written after the THEN clause of an IF statement.

Personal tools