A Literal is a fixed value written directly into the code. Literals represent actual data rather than references to data stored elsewhere. Every literal has a specific Data Type that determines what kind of value it represents.
Boolean literals represent logical values and can only be True or False.
NEW BOOL x = TRUE
NEW BOOL y = FALSE
PRINTLN x // Displays "TRUE"
PRINTLN y // Displays "FALSE"Integer literals represent whole numbers without decimal points. Valid range is -2147483648 to 2147483647 (inclusive).
NEW INT x = 42
NEW INT y = -15
NEW INT z = 0
PRINTLN x // Displays "42"
PRINTLN y // Displays "-15"
PRINTLN z // Displays "0"Float literals represent numbers with decimal points. They must always include a decimal point, even for whole numbers. Valid range is -1.175494e-38 to 3.402823e+38 (inclusive).
NEW FLOAT x = 3.14
NEW FLOAT y = -2.5
NEW FLOAT z = 1.0
PRINTLN x // Displays "3.14"
PRINTLN y // Displays "-2.5"
PRINTLN z // Displays "1.0"String literals represent text and must be enclosed in double quotes ("). They can contain any Printable ASCII Characters.
NEW STR x = "Hello World!"
NEW STR y = "123"
NEW STR z = ""
PRINTLN x // Displays "Hello World!"
PRINTLN y // Displays "123"
PRINTLN z // Displays ""NEW STR name = "Alice"
NEW INT age = 25
NEW FLOAT height = 5.6
NEW BOOL isStudent = TRUENEW INT sum = 10 + 5 // Using Integer Literals
NEW STR greeting = "Hello" .. " " .. "World" // Using String Literals
NEW BOOL check = 5 > 3 // Expression evaluates to Boolean Literal TRUEPRINTLN "Direct text output" // String Literal
PRINTLN 42 // Integer Literal
PRINTLN 3.14 // Float Literal
PRINTLN TRUE // Boolean LiteralNEW FLOAT x = 5 // Runtime error! 5 is an Integer Literal, not a Float Literal
NEW FLOAT y = 5.0 // Correct! 5.0 is a Float LiteralNEW INT x = 5.0 // Runtime error! 5.0 is a Float Literal, not an Integer Literal
NEW INT y = 5 // Correct! 5 is an Integer LiteralNEW STR x = Hello // Syntax error! String Literals must be enclosed in quotes
NEW STR y = "Hello" // Correct! String Literal is enclosed in quotes