Skip to main content
100%

Fizz Buzz in XQuery

✓ Published0🌍 Public
CCliffordAnderson
Last edited Jul 18, 2013
Created on Jul 18, 2013

This example demonstrates the classic Fizz Buzz logic, where numbers divisible by 3 and 5 are replaced with the word "fizzbuzz", those divisible by only 3 with "fizz", and those divisible by only 5 with "buzz". The code iterates over a fixed range of integers from 1 to 30 using an XQuery `for` loop. It applies nested `if`/`else` expressions to evaluate the modulo conditions (`$i mod 3` and `$i mod 5`) and returns the appropriate string or the original number. The entire computation is performed entirely within XQuery 3.0, with no external libraries or data sources involved.

AI-generated description

Similar vizzes