Getting Started with Strata
Welcome to Strata! This guide will help you get up and running with Strata in just a few minutes.
What You'll Learn
- How to install Strata
- How to write your first program
- Basic concepts and syntax
- How to compile and run Strata code
Prerequisites
- Early Access: Strata is in very early development (pre-alpha). Access requires approval.
- Basic familiarity with programming concepts
Installation
Early Access Required: Strata is currently in very early development: it's not even in alpha yet. Access is limited and requires approval.
To use Strata, please submit a request here: Request Access
For detailed information, see the Installation Guide.
Your First Program
Create a file called hello.str:
fn main(): Void {
print("Hello, Strata!");
}Run:
strata run hello.strYou should see: Hello, Strata!
Note: You can also build to PHP first with
strata build hello.str, then run the generated PHP file from thebuild/directory. Theruncommand is faster for development.
Understanding the Code
Let's break down what we just wrote:
fn main(): Void {fn- declares a functionmain- the function name (entry point): Void- the return type (returns nothing)
print("Hello, Strata!");print()- outputs text to the console- Strings are enclosed in double quotes
The main() function returns Void.
Important: Named Arguments Required
In Strata, all function arguments must be named when calling functions. Positional arguments are not allowed:
fn add(a: Int, b: Int): Int {
return a + b;
}
// correct: named arguments
let sum = add(a: 5, b: 3);
// Error: positional arguments not allowed
let sum = add(5, 3);This also applies to class instantiation:
class User(name: String, email: String) {
// ...
}
// correct
let user = User(name: "Donald", email: "donaldpakkies@gmail.com);
// Error: positional arguments not allowed
let user = User("Donald", "donaldpakkies@gmail.com");Named arguments make code more readable and self-documenting. See Functions for more details.
Important: Top-Level Code
In Strata, the top level is primarily for declarations (functions, classes, types, etc.) and simple setup logic (like let definitions and print). Complex execution logic like loops, if/else statements, and error handling must reside inside functions (like main()). See Top-Level Code for complete details.
Next Steps
Now that you've written your first program, explore:
- Language Reference - Learn about types, functions, classes, and more
- Examples - See real-world code examples
- Error Handling - Learn how Strata handles errors
Ready to learn more? Continue to the Language Reference →