From 7bf99fd17504d0cf34f52048b75bc3c6f280b096 Mon Sep 17 00:00:00 2001 From: Theodoros Oikonomou Date: Thu, 14 Aug 2014 10:25:30 +0100 Subject: [PATCH] Dreams on, dreamers --- thikonom/dreams.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 thikonom/dreams.md diff --git a/thikonom/dreams.md b/thikonom/dreams.md new file mode 100644 index 0000000..f16406c --- /dev/null +++ b/thikonom/dreams.md @@ -0,0 +1,18 @@ +# Dreams + +## Technical + +### Pattern Matching + +Pattern matching is a powerful programming feature adopted by various programming languages that I would love to see in newer versions of Python. +Here is an example from `Rust` which shows how to match against an integer value: + + fn print_number(n: int) { + match n { + x if x < 0 => println!("less than zero"), + 0 => println!("zero"), + 1 | 2 => println!("one or two"), + y @ 3..10 => println!("3 <= {} <= 10", y), + _ => println!("greater than 10") + } + }