Lines and Statements

A nuBASIC program will normally consist of a series of statements.

These statements could comprise assignment that define new variables, conditional statements and flow control statements.

nuBASIC supports old-style programs where all the statements begin with a line number or new one where line number is not needed. The first format is supported but deprecated.

nuBASIC language is compatible with modern structured programming theory by discarding the line numbers and adding the control structures and subroutine definitions needed by structured programming. 

Example: Hello World Loop application which uses line numbers 

10 Cls 
20 Rem repeat 
30 Print “Hello World” 
40 GoTo 20 

Example: Hello World Loop application which uses labels 

Cls
repeat: ' <- label 
    Print “Hello World” 
    GoTo repeat


The BASIC interpreter's line-oriented execution produces one of the key differences between BASIC and other programming languages. Whereas the position of hard line breaks in the source code of Java or C++ programs is irrelevant, each line in a BASIC program forms a self-contained unit. 
Function calls, mathematical expressions, and other linguistic elements, such as function and loop headers, must be completed on the same line that they begin on.
To linking individual lines you can use colons to divide one line into several sections so that there is enough space for several expressions. 

For example, the assignments
 
a% = 1
a% = a% + 1

can be written as follows:
 
a% = 1: a% = a% +1
Comments