User Tools

Site Tools


en:programsyntax

Program Syntax

Statements

BASIC-256 programs consist of a series of statements separated by newlines, which are executed in order.

2016/08/13 13:06 · admin

Label

A line may optional begin with a label followed without a space with a colon to be used as a destination of a goto, gosub, or onerror.

print "before"
gosub display
print "after"
end

display:  print "in gosub"
return
2016/08/13 11:35 · admin

Compound Statement

Multiple statements may be included on a single line by separating then with a : (colon), this is called a compound statement. In the context of the language a single statement is also considered a “compound statement”.

total= 0: for t=1 to 10: total = total + t: next t: print "the total of 1 to 10 is " + total

Special care should be taken when including if/then statements in a compound line:

2016/08/13 11:49 · admin

Example

The following is a sample program that shows single line statements, compound statements, and use of a label.

print "hello ";
gosub world
end

world: ### print out world
print "w";
print "o";: print "r";: print chr(asc("a")+11);
print right('Dd',1)
return
en/programsyntax.txt · Last modified: 2016/08/13 13:06 by admin