Mode:
Duration:
1
2
3
4
5
6
declare function local:fib($n) {
if ($n = 0) then 0
else if ($n = 1) then 1
else local:fib($n - 1) + local:fib($n - 2)
};
for $i in 0 to 9 return local:fib($i)Coding works best on desktop or with an external keyboard.
declare function local:fib($n) {
if ($n = 0) then 0
else if ($n = 1) then 1
else local:fib($n - 1) + local:fib($n - 2)
};
for $i in 0 to 9 return local:fib($i)Coding works best on desktop or with an external keyboard.
Generates first 10 Fibonacci numbers using XQuery recursion.
declare function local:fib($n) {
if ($n = 0) then 0
else if ($n = 1) then 1
else local:fib($n - 1) + local:fib($n - 2)
};
for $i in 0 to 9 return local:fib($i)XQuery is a functional, expression-oriented language designed for querying, transforming, and manipulating XML data. It provides powerful tools for navigating hierarchical structures using XPath and is widely used in systems that store or exchange data in XML.
Origin & Creator
Developed by the W3C XML Query Working Group in the early 2000s as a standard querying language for XML.
Industrial Note
XQuery is especially prominent in enterprise environments involving XML databases, digital publishing, content management, e-commerce feeds, and metadata-heavy systems.