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
- Writing a def Function
- Writing an fn Function
- When to Reach for Each
- Return Types and None