Skip to content

Types

RayQuiro is a dynamically typed language with primitive types, collection types, and user-defined structures.


TypeType Identifier (type())Example Literals
Number"number"42, 3.14159, -0.5, 1e6
String"string""hello", "UTF-8: Привет", ""
Boolean"bool"true, false
Null"null"null
Array"array"[], [1, "two", 3.0]
Object"object"{}, { name: "Hero", hp: 100 }
Function"function"fn(x) { return x; }

All numbers in RayQuiro are IEEE 754 double-precision 64-bit floating point values (double).

var integer_val = 100;
var float_val = 3.14159265;
var negative = -42;

RayQuiro includes built-in math functions available globally:

FunctionSignatureDescription
absabs(x)Absolute value.
sqrtsqrt(x)Square root.
powpow(x, y)Raises x to power y.
floorfloor(x)Rounds downward to the nearest integer.
ceilceil(x)Rounds upward to the nearest integer.
roundround(x)Rounds to the nearest integer.
minmin(a, b)Returns the smaller of two numbers.
maxmax(a, b)Returns the larger of two numbers.
clampclamp(x, min, max)Clamps x within [min, max].

Strings are immutable sequences of UTF-8 characters enclosed in double quotes:

var greeting = "Hello, RayQuiro!";
var length = len(greeting);
var full = "Count: " + str(42);
var user = "Alice";
var score = 100;
var message1 = f"Player {user} has score {score + 10}!";
var message2 = `Welcome, ${user}!`;
var num_val = num("123.45");
var str_val = str(100);

Booleans can be either true or false:

var is_active = true;
var is_admin = false;

When evaluated in conditionals (if, while):

  • false, null, 0, and "" (empty string) evaluate to falsy.
  • All other values evaluate to truthy.

null represents the deliberate absence of any value:

var user = null;
var username = user ?? "Anonymous";
print(username);

Arrays are ordered, dynamically sized lists of values:

var inventory = ["potion", "shield", "sword"];
print(inventory[0]);
inventory[0] = "super_potion";
push(inventory, "helmet");
print("Total items: " + str(len(inventory)));

Objects are key-value associative maps:

var player = {
name: "Aria",
level: 25,
health: 100.0
};
print(player["name"]);
player["health"] = 85.0;
var field_names = keys(player);
var field_values = values(player);

RayQuiro supports struct definitions for structured data models with default values:

struct Item {
id: 0,
title: "Unknown Item",
price: 0.0
}
var sword = Item { id: 101, title: "Iron Blade", price: 45.5 };
print(sword["title"]);
print(sword["id"]);

print(type(42));
print(type("text"));
print(type(true));
print(type(null));
print(type([1, 2]));
print(type({ a: 1 }));
print(type(fn() {}));