Welcome to Topaz! This guide takes you from Topaz environment setup to running your first program as quickly and smoothly as possible. 10 minutes is all you need!
Audience
This guide is for developers getting started with Topaz and walks through installation by environment.
Installation
Topaz can be installed through official distribution paths. Choose one of:
- Dev Portal: Sign in → Tools → Topaz → Install
- Setup Docs: Follow the “Topaz Workstation Setup” guide
- Support: If you run into setup or access issues, submit a request through the support queue
Notes
- Depending on your environment, account sign-in or network configuration may be required.
- Builds are available for macOS, Linux, and Windows.
- Follow the OS-specific official installation guidance.
Verify Installation
Check if the installation was successful:
topaz --version
If you see version info like Topaz 1.0.0, you're all set!
Your First Program
Let's start with the simplest Topaz program.
Create a hello.tpz file and enter the following code:
// Your first Topaz program
let greeting = "Hello, Topaz world!"
print(greeting)
Run the program:
topaz run hello.tpz
Output:
Hello, Topaz world!
Congratulations! You've successfully run your first Topaz program.
Experiment with REPL
Topaz provides a powerful REPL (Read-Eval-Print Loop). You can execute code instantly and see results, making it perfect for learning and experimentation.
Enter this command in your terminal:
topaz repl
Once the REPL starts, try experimenting like this:
let name = "Developer"
"Developer"
let age = 25
25
"Hello, {name}! You are {age} years old!"
"Hello, Developer! You are 25 years old!"
let scores = [85, 92, 78, 96, 88]
[85, 92, 78, 96, 88]
scores.map(x => x + 5)
[90, 97, 83, 101, 93]
To exit the REPL, press Ctrl+C or type .exit.
More Interesting Examples
Now let's create more interesting examples that showcase Topaz's charm.
Create a fibonacci.tpz file:
// Fibonacci sequence calculator
function fibonacci(n: int) -> int {
match n {
case 0 => 0
case 1 => 1
case _ => fibonacci(n-1) + fibonacci(n-2)
}
}
// Print first 10 Fibonacci numbers
let result = (0..<10).map(fibonacci)
print("Fibonacci sequence (first 10): {result}")
// Web API data fetching example
let userData = fetch("https://jsonplaceholder.typicode.com/users/1")
|> json()
|> (data => data.name)
print("User name from API: {userData}")
Run it:
topaz run fibonacci.tpz
Next Steps
Excellent! You've now mastered the basics of Topaz. Take the next steps:
Learn Core Concepts
- Syntax Basics - Basic Topaz language syntax
- Data Types - Strings, numbers, arrays, objects, etc.
- Functions & Closures - Core of functional programming
Build Real Projects
- First Interop Project - Build a Rust/Actix interop walkthrough
- Using Web APIs - Data processing and transformation
- Understanding Recursion - Advanced programming patterns
Complete Reference
- Core Functions - Complete guide to built-in functions
- Functional Library - map, filter, reduce, etc.
- Operators - All operators reference
Congratulations!
You are now a Topaz developer!
Start your journey where coding becomes poetry. With Topaz, even complex logic can be expressed as beautiful, readable code.
For help, check the official docs and support channels.