Hello, Mux!
Your first Mux program:
func main() returns void {
print("Hello, Mux!")
}
Get Started with the full installation guide.
Quick Examples
Pattern matching with Result types:
match result {
Ok(value) { print(value.to_string()) }
Err(error) { print("Error: " + error) }
}
Explore the Language Guide for more.
Why Choose Mux?
Simple & Readable
Clean syntax with no semicolons, clear type inference using `auto`, and explicit error handling with `Result` and `Optional` types. Code that is easy to read and maintain.
Type Safe
Strong static typing catches errors at compile time. No implicit conversions, powerful generics with monomorphization, and compile-time exhaustiveness checking.
Fast & Efficient
Native performance through LLVM code generation. Reference-counted memory management provides safety without garbage collection pauses or complex ownership rules.
Pattern Matching
Expressive pattern matching with guards for elegant control flow. Match on enums, Optionals, Results, and primitives with complete type safety.
Memory Safe
Automatic memory management using reference counting. No manual allocation, no garbage collector, and deterministic cleanup without a complex borrow checker.
Modern & Expressive
Full-featured with generics, interfaces, tagged union enums, collection literals, and lambda functions. A modern language for modern development.
See Mux In Action
Type-Safe Error Handling
func divide(int a, int b) returns Result<int, string> {
if b == 0 {
return Err("division by zero")
}
return Ok(a / b)
}
auto result = divide(10, 2)
match result {
Ok(value) {
print("Result: " + value.to_string())
}
Err(error) {
print("Error: " + error)
}
}
Generics & Collections
class Stack<T> {
list<T> items
func push(T item) returns void {
self.items.push_back(item)
}
func pop() returns Optional<T> {
if self.items.is_empty() {
return None
}
return self.items.pop_back()
}
}
auto stack = Stack<int>.new()
stack.push(100)
Ready to Get Started?
Explore the documentation and start building with Mux today.
Mux is open source and licensed under MIT.
