Algorithms · real, tested code

FizzBuzz in Larzscript

The classic interview warm-up: print 1 to N, but Fizz for multiples of 3, Buzz for multiples of 5, FizzBuzz for both.

No package needed - just the core language's while loop, modulo, and string concatenation.

Code

let i = 1
while i <= 15 {
  if i % 15 == 0 { print("FizzBuzz") }
  else if i % 3 == 0 { print("Fizz") }
  else if i % 5 == 0 { print("Buzz") }
  else { print(i) }
  i = i + 1
}
Output
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz

Why this matters in Larzscript

Nothing money-native here on purpose - this one's a baseline showing the core syntax reads like any modern scripting language before any of the wallet/pay primitives enter the picture.