Rust does not have NULL; use the Option<T> enum to represent values that might be missing. Match on the Some variant to use the value or handle None to avoid crashes.
fn get_user_id() -> Option<i32> {
// Returns Some(id) if found, None if not
Some(42)
}
fn main() {
match get_user_id() {
Some(id) => println!("User ID: {}", id),
None => println!("User not found"),
}
}