{"name":"fizzbuzz.nu","source":"// fizzbuzz.nu — Classic FizzBuzz in NURL\n//\n// Demonstrates:\n//   - Functions with prefix notation\n//   - Conditionals (? cond then else)\n//   - While loops (~ cond { body })\n//   - Mutable variables (: ~ type name value)\n//   - String operations\n//\n// Build & run:\n//   ./build/nurlc examples/fizzbuzz.nu > /tmp/fizzbuzz.ll\n//   clang /tmp/fizzbuzz.ll stdlib/runtime.o -o /tmp/fizzbuzz\n//   /tmp/fizzbuzz\n\n@ fizzbuzz i n → v {\n    : ~ i i 1\n    ~ <= i n {\n        : b div3 == 0 % i 3\n        : b div5 == 0 % i 5\n\n        ? & div3 div5\n        { ( nurl_print `FizzBuzz\\n` ) }\n        ? div3\n        { ( nurl_print `Fizz\\n` ) }\n        ? div5\n        { ( nurl_print `Buzz\\n` ) }\n        // nurl_str_cat lives in stdlib/core/string.nu — call without\n        // importing it would emit `@nurl_str_cat` without a `declare`\n        // and fail at link. Use the runtime's nurl_print_int instead.\n        { ( nurl_print_int i ) ( nurl_print `\\n` ) }\n\n        = i + i 1\n    }\n}\n\n@ main → i {\n    ( fizzbuzz 30 )\n    ^ 0\n}\n","bytes":1023}