Syntax
The syntax of FORGE language is similar to many BASIC dialects, with the following main rules:
Line Types
A program line must be one of 4 types:
- Comment line - Starting with a dot
.or an apostrophe' - Statement - A statement followed by its parameters
- Variable assignment - A name followed by
=and the expression for the new value. For string variables, there is also a concatenation operator,=+. - Empty line
Case Insensitivity
All statements and variable names can be lower or uppercase, the language is case insensitive.
PRINT "Hello" print "Hello" Print "Hello"
All of these are equivalent.
Statement Abbreviations
Statements can be abbreviated to reduce typing; each statement has a different abbreviation.
For example:
PRINTcan be abbreviated as?RANDcan be abbreviated asR.IFcan be abbreviated asI.
See the Statements reference for specific abbreviations.
Multiple Statements Per Line
Multiple statements can be put on the same line by placing a colon : between statements.
A = 10 : B = 20 : PRINT A, B
Comments
After any statement a comment can be included by starting it with an apostrophe '.
PRINT "Hello" ' This is a comment A = 10 ' Another comment
Full-line comments can start with either ' or .:
' This is a full-line comment . This is also a full-line comment
No Line Numbers
No line numbers are allowed. FORGE uses a modern line-based structure without numeric line references.
Optional Spaces
Spaces after statements and between operators are optional and ignored.
PRINT A+B PRINT A + B PRINT A+B
All of these are equivalent.
Notation Conventions
In the following chapters, whenever a value can take any numeric expression, it is written as _value_, and whenever you can use a string it is written as *text*.
Examples
Valid Syntax
' Comment line PRINT "Hello" A = 10 B$ = "World" PRINT A, B$
Multiple Statements
A = 10 : B = 20 : PRINT A + B
With Comments
A = 10 ' Initialize counter PRINT A ' Display value
Next Steps
- Expressions - Learn about expressions and operators
- Statements - Complete statement reference
- Functions - Available functions