Skip to content

Instantly share code, notes, and snippets.

@marvhus
Created September 12, 2023 15:13
Show Gist options
  • Save marvhus/de3f503b614070906d79f9965a7adc95 to your computer and use it in GitHub Desktop.
Save marvhus/de3f503b614070906d79f9965a7adc95 to your computer and use it in GitHub Desktop.
FizzBuzz in Jai
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