This page explains the basic building blocks you write inside LunarBasic code: names, numbers, strings, booleans, and coordinates.
Identifiers are the names you give variables, constants, labels, and routines.
counter
_temp
name$
value1
LunarBasic supports classic BASIC-style type suffixes on identifier names. These suffixes automatically affect the identifier's data type.
Examples:
playerName$
score%
speed!
distance#
If an identifier has one of these suffixes, that suffix type is used by the compiler. This applies to variables, constants, parameters, loop variables, and function names.
You can still use As syntax, but if both are present they must agree. For example, name$ As String is valid, but name$ As Integer is not.
LunarBasic currently supports three number styles.
&H prefix123
45.6
.5
&HFF
&h10
Hexadecimal literals use digits 0 through 9 and letters A through F after the &H prefix. The prefix is case-insensitive.
Strings are wrapped in double quotes.
Doubled double-quotes are used to place a quote inside the string.
"hello"
"a""b"
"a""b" means a"b.
An unterminated string is a syntax error.
True
False
These are values, not keywords.
The game-facing coordinate system is intended to be integer-based.