Variables and Data Types

RCBasic has two fundamental data types: Numbers and Strings.

Numbers

Number variables store integer or floating-point values. Variable names must not end with $:

score   = 100
speed = 3.14
lives = 3

Strings

String variables store sequences of characters. Their names must end with $:

name$    = "Alice"
message$ = "Game Over"

Constants

Use Const to declare a value that never changes:

Const MAX_LIVES = 3
Const TITLE$ = "My Game"

Arrays

Arrays store multiple values under one name. Declare them with Dim:

Dim scores[10]          ' number array with 10 elements (0–9)
Dim names$[5] ' string array with 5 elements

scores[0] = 95
names$[0] = "Alice"

Multi-dimensional arrays:

Dim grid[8][8]          ' 8×8 number grid
grid[3][4] = 1

See also

Full array API: Arrays

User-Defined Types

Group related variables into a Type (a struct-like record):

Type Player
x
y
health
name$
End Type

Dim p As Player
p.x = 100
p.y = 200
p.health = 100
p.name$ = "Hero"

Type arrays:

Dim enemies[10] As Player
enemies[0].x = 50