summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-15-binding-catchall/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-15-binding-catchall/src/main.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-15-binding-catchall/src/main.rs b/src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-15-binding-catchall/src/main.rs
new file mode 100644
index 000000000..6ce0b5998
--- /dev/null
+++ b/src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-15-binding-catchall/src/main.rs
@@ -0,0 +1,14 @@
+fn main() {
+ // ANCHOR: here
+ let dice_roll = 9;
+ match dice_roll {
+ 3 => add_fancy_hat(),
+ 7 => remove_fancy_hat(),
+ other => move_player(other),
+ }
+
+ fn add_fancy_hat() {}
+ fn remove_fancy_hat() {}
+ fn move_player(num_spaces: u8) {}
+ // ANCHOR_END: here
+}