0Pricing
Mojo Academy · Lesson

When to Reach for Each

Match the function style to your goal.

Two Tools, One Choice

Mojo gives you both def and fn. Picking well means matching the tool to what your code actually needs. 🧭

Choose def for Flexibility

Pick def when you are exploring, prototyping, or want Python-like ease without committing to types just yet.

def quick_test(data):
    return len(data)

All lessons in this course

  1. Writing a def Function
  2. Writing an fn Function
  3. When to Reach for Each
  4. Return Types and None
← Back to Mojo Academy