Created
July 28, 2016 17:54
-
-
Save mdg/ee194eec23721ebe90e728c4c5bf324f to your computer and use it in GitHub Desktop.
fizzbuzz with new block syntax in leema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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