summaryrefslogtreecommitdiff
path: root/exercises/option
diff options
context:
space:
mode:
Diffstat (limited to 'exercises/option')
-rw-r--r--exercises/option/option3.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/exercises/option/option3.rs b/exercises/option/option3.rs
new file mode 100644
index 0000000..045d2ac
--- /dev/null
+++ b/exercises/option/option3.rs
@@ -0,0 +1,19 @@
+// option3.rs
+// Make me compile! Execute `rustlings hint option3` for hints
+
+// I AM NOT DONE
+
+struct Point {
+ x: i32,
+ y: i32,
+}
+
+fn main() {
+ let y: Option<Point> = Some(Point { x: 100, y: 200 });
+
+ match y {
+ Some(p) => println!("Co-ordinates are {},{} ", p.x, p.y),
+ _ => println!("no match"),
+ }
+ y; // Fix without deleting this line.
+}