Names and Values

This page explains the basic building blocks you write inside LunarBasic code: names, numbers, strings, booleans, and coordinates.

Back to Language Reference


Identifiers

Identifiers are the names you give variables, constants, labels, and routines.

counter
_temp
name$
value1

Classic Type Suffixes

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.

Number Literals

LunarBasic currently supports three number styles.

123
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.

String Literals

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.

Boolean Literals

True
False

These are values, not keywords.

Case Sensitivity

Coordinate System

The game-facing coordinate system is intended to be integer-based.