First Program
This page walks through practical first steps in RayQuiro 0.1.0 — from the smallest possible script to working with modules.
🟢 Smallest Program
Create a file hello.rq:
print("Hello from RayQuiro 0.1.0!");
Run it:
rqio hello.rq
Output:
Hello from RayQuiro 0.1.0!
📝 Variables And Expressions
var language = "RayQuiro";
var version = "0.1.0";
print(language + " " + version);
Use let for constants:
let pi = 3.14159;
let app_name = "MyApp";
print(app_name, "is using pi:", pi);
🔧 Functions
Declare with fn:
fn greet(name) {
return "Hello, " + name + "!";
}
print(greet("World"));
Functions with multiple parameters:
fn sum(a, b) {
return a + b;
}
print("7 + 5 =", sum(7, 5));
If you define a main() function, call it manually:
fn main() {
print("main() running");
}
main();
📦 Arrays And Loops
var modes = ["run", "vm", "pack", "bundle"];
for (var i = 0; i < len(modes); i = i + 1) {
print("mode:", modes[i]);
}
Using while:
var count = 0;
while (count < 3) {
print("count:", count);
count = count + 1;
}
🔄 Conditionals
var score = 82;
if (score >= 90) {
print("Grade: A");
} else if (score >= 70) {
print("Grade: B");
} else {
print("Grade: C");
}
🧩 Using Built-In System Modules
import rayquiro.time as time;
import rayquiro.json as json;
import rayquiro.fs as fs;
var started = time.now_ms();
// Write a file
fs.write("output/info.json", json.stringify({"name": "RayQuiro", "version": "0.1.0"}));
// Read it back
var text = fs.read("output/info.json");
var data = json.parse(text);
print("Name:", data["name"]);
print("Version:", data["version"]);
print("Elapsed:", time.now_ms() - started, "ms");
🏗️ Running As A Project
If your folder has a rqproject.json and a main.rq, just run:
rqio
Typical project setup:
rqio init my-app
cd my-app
rqio
📦 Building And Packaging
Package as bytecode:
rqio pack main.rq
rqio build/main.rqb
Compile to a Windows executable:
rqio build main.rq
Create a distributable bundle:
rqio bundle main.rq -o dist/my-app