Examples

Learn Juno through practical code examples

Recursive Fibonacci

A classic recursive algorithm that showcases Juno's explicit type casting system. Notice how we cast between int and uint — Juno requires explicit conversions, preventing subtle bugs from implicit type coercion.

import Io;

uint fib(int n) {
  if (n < 2) {
    return uint<n>;
  }
  return fib(n-1) + fib(n-2);
}

void main() {
  int n = 6;
  Io.println("fib("^^string<n>^^") = "^^string<fib(n)>);
}

Key features demonstrated:

Output:

fib(6) = 8

More examples coming soon!

I'm working on adding more examples to showcase Juno's features. Check back soon for:

Want to contribute an example? Check out our GitHub repository!