From 07c9a5e8c953c4820d846e6f5aaf3198daa2af7b Mon Sep 17 00:00:00 2001 From: wowkster Date: Thu, 27 Apr 2023 12:18:09 -0400 Subject: [PATCH] chore(examples): :memo: add more examples (8 & 9) --- examples/8_control_flow.leek | 10 ++++++++++ examples/9_guard.leek | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 examples/8_control_flow.leek create mode 100644 examples/9_guard.leek diff --git a/examples/8_control_flow.leek b/examples/8_control_flow.leek new file mode 100644 index 0000000..b15e53e --- /dev/null +++ b/examples/8_control_flow.leek @@ -0,0 +1,10 @@ +fn main() { + leak a = 69 + leak b = 420 + + if a > b { + println("a is greater") + } else { + println("b is greater") + } +} \ No newline at end of file diff --git a/examples/9_guard.leek b/examples/9_guard.leek new file mode 100644 index 0000000..b97ef56 --- /dev/null +++ b/examples/9_guard.leek @@ -0,0 +1,7 @@ +fn div(a: i32, b: i32) -> i32? { + unless b != 0 { + yeet None + } + + yeet a / b +} \ No newline at end of file