Skip to content

Instantly share code, notes, and snippets.

@mdg
Created July 28, 2016 17:54
Show Gist options
  • Select an option

  • Save mdg/ee194eec23721ebe90e728c4c5bf324f to your computer and use it in GitHub Desktop.

Select an option

Save mdg/ee194eec23721ebe90e728c4c5bf324f to your computer and use it in GitHub Desktop.
fizzbuzz with new block syntax in leema
diff --git a/T/fizzbuzz.lma b/T/fizzbuzz.lma
index beb36ad..086dd3c 100644
--- a/T/fizzbuzz.lma
+++ b/T/fizzbuzz.lma
@@ -1,25 +1,19 @@
-func fizzbuzz(x, max): Void {
+func fizzbuzz(x, max): Void ->
let xm30 = (x mod 3) = 0
let xm50 = (x mod 5) = 0
- if xm30 and xm50 {
- cout("fizzbuzz\n")
- } else if xm30 {
- cout("fizz\n")
- } else if xm50 {
- cout("buzz\n")
- } else {
- cout("$x\n")
- }
+ if
+ |xm30 and xm50 -- cout("fizzbuzz\n")
+ |xm30 -- cout("fizz\n")
+ |xm50 -- cout("buzz\n")
+ |else -- cout("$x\n")
+ --
- if x < max {
+ if x < max ->
fizzbuzz(x+1, max)
- } else {
- }
-}
+ --
+--
-func main() {
- fizzbuzz(1, 100)
-}
+func main() -- fizzbuzz(1, 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment