Getting Started
What is Ori?
Ori is a general-purpose, expression-based language with strict static typing, type inference, and mandatory testing. Every function requires tests, every effect is explicit, and the compiler enforces code integrity.
Install
curl -fsSL https://ori-lang.com/install.sh | sh
Your First Program
Create a file called hello.ori:
@main () -> void = print(msg: "Hello, World!")
Run it:
ori run hello.ori
Functions and Testing
Every function in Ori requires tests. Here’s a function with its test:
@add (a: int, b: int) -> int = a + b
@test_add tests @add () -> void = run(
assert_eq(actual: add(a: 2, b: 3), expected: 5),
assert_eq(actual: add(a: -1, b: 1), expected: 0),
)
@main () -> void = run(
print(msg: "2 + 3 = " + str(add(a: 2, b: 3)))
)
Key Concepts
- Mandatory testing — every function needs
@testblocks or the compiler rejects it - Named arguments —
add(a: 2, b: 3)notadd(2, 3) - Expression-based — everything is an expression, no statements
- No null — use
Option<T>for optional values,Result<T, E>for errors - Explicit effects — functions declare capabilities like
uses Http
Try It Online
Head to the Playground to write and run Ori code in your browser.
Next Steps
- Read the Language Specification for formal definitions
- Explore Types and Expressions
- Learn about Testing and Capabilities