Files
rustlings/exercises/12_options/options3.rs
T

18 lines
411 B
Rust
Raw Normal View History

2026-03-12 20:54:14 -04:00
#[derive(Debug)]
struct Point {
x: i32,
y: i32,
}
fn main() {
let optional_point = Some(Point { x: 100, y: 200 });
// TODO: Fix the compiler error by adding something to this match statement.
match optional_point {
2026-03-23 03:36:33 -04:00
Some(ref p) => println!("Coordinates are {},{}", p.x, p.y),
2026-03-12 20:54:14 -04:00
_ => panic!("No match!"),
}
println!("{optional_point:?}"); // Don't change this line.
}