Literals and variables

Literals create primitive values directly in source code. Variables give those values a name and an explicit type.

Literals

int decimalValue = 42;
int hexadecimal = 0x2A;
int binary = 0b101010;

float ratio = 0.5f;
double distance = 12.75;
bool ready = true;

A string literal produces an immutable, null-terminated UTF-8 byte sequence with type readonly byte*.

readonly byte* message = "Hello from Xenon";

The null literal receives a concrete pointer type from its surrounding declaration or call.

Local variables

Variable declarations use type-first syntax. A local becomes readable after a value has been assigned to it.

int count = 10;
float speed;

speed = 4.5f;

Each declaration introduces one local name into the current block scope. Nested blocks may introduce their own locals.

Compile-time constants and runtime immutability are separate concepts. See const and readonly.