Create websites with TailwindCSS
Start building the next great SAAS
Alpine & Tailwind UI Library
Plug'n Play Authentication for Laravel
Create website designs with AI
Blog platform for developers
Build a simple static website
21-day program to build a SAAS
fn main() {
let error: Result<(), &str> = Err("error"); // Error
// Show error instead of panic
match error {
Ok(_) => println!("Ok"),
Err(e) => println!("Error: {}", e),
}
println!("Still running ๐");
// Output:
// Error: error
// Still running ๐
}
Here is what the above code is doing:
1. The function returns a Result<T, E> type. The Ok(T) value holds a T value, and the Err(E) value holds an E value.
2. The match expression is used to decide what to do based on the Result value. In this case,