Created
September 12, 2023 15:13
-
-
Save marvhus/de3f503b614070906d79f9965a7adc95 to your computer and use it in GitHub Desktop.
FizzBuzz in Jai
This file contains 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
fizzbuzz :: (low: u32, high: u32) { | |
_print :: (str: string) #expand { | |
print("%", str); | |
`already_printed = true; | |
} | |
for i: low..high { | |
already_printed := false; | |
if i % 3 == 0 then _print("Fizz"); | |
if i % 5 == 0 then _print("Buzz"); | |
if !already_printed then print("%", i); | |
print("\n"); | |
} | |
} | |
main :: () { | |
fizzbuzz(1, 15); | |
} | |
#import "Basic"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment