Quick Start¶
Let's get you up and running with Raven in just a few minutes!
Your First Program¶
Create a file called hello.rv:
fun main() -> void {
print("Hello, Raven!");
}
main();
Run it:
You should see: Hello, Raven!
Interactive REPL¶
Try the interactive mode:
You'll see the Raven prompt:
raven> let name: string = "World";
raven> print(format("Hello, {}!", name));
Hello, World!
raven> exit
Basic Syntax¶
Variables¶
let name: string = "Alice";
let age: int = 25;
let height: float = 5.9;
let isActive: bool = true;
Arrays¶
let numbers: int[] = [1, 2, 3, 4, 5];
numbers.push(6);
print(numbers); // [1, 2, 3, 4, 5, 6]
Control Flow¶
let age: int = 18;
if (age < 18) {
print("Too young");
} else {
print("Welcome!");
}
// While loop
let i: int = 0;
while (i < 5) {
print(i);
i = i + 1;
}
Functions¶
fun greet(name: string) -> void {
print(format("Hello, {}!", name));
}
fun add(a: int, b: int) -> int {
return a + b;
}
// Usage
greet("Raven");
let result: int = add(5, 3);
print(result); // 8
Data Structures¶
Structs¶
struct Person {
name: string,
age: int,
isActive: bool
}
let person: Person = Person {
name: "Alice",
age: 25,
isActive: true
};
print(person.name); // Alice
Enums¶
enum HttpStatus {
OK,
NotFound,
InternalError
}
let status: HttpStatus = HttpStatus::OK;
print(status); // HttpStatus::OK
File Operations¶
// Write to file
let content: string = "Hello from Raven!";
write_file("output.txt", content);
// Read from file
if (file_exists("output.txt")) {
let data: string = read_file("output.txt");
print(data);
}
Next Steps¶
Now that you've got the basics:
- Language Reference - Complete syntax guide
- Standard Library - Built-in functions
- rvpm and formatting -
rv.toml, formatter,rvpm fmt - Examples - More sample programs
- VS Code Extension - Development setup
Common Commands¶
# Run a program
raven program.rv
# Start REPL
raven
# Type-check only (parse + types; does not run)
raven program.rv -c
# Verbose output (tokens, AST)
raven program.rv -v
# Show help
raven --help
Project commands (rvpm)¶
From a directory that contains (or is under) an rv.toml project:
rvpm init my_app # create rv.toml, src/main.rv, rv_env/
cd my_app
rvpm run # runs raven on src/main.rv
rvpm fmt # format .rv files (optional [fmt] in rv.toml)
rvpm fmt --check # fail if formatting would change files (CI)
Ready for more? Check out our Language Reference for complete syntax details!