0Pricing
Mojo Academy · Lesson

Reading Function Signatures

Understand a function from its declaration.

The Signature Is the Contract

A function's signature is its first line: the name, the parameters, and the return type. Read it well and you know how to call the function.

fn area(width: Int, height: Int) -> Int:

Spotting the Name

Right after fn or def comes the name. It should hint at what the function does, like area, parse, or connect.

fn parse(text: String) -> Int:

All lessons in this course

  1. Positional and Keyword Arguments
  2. Default Argument Values
  3. Returning Multiple Values
  4. Reading Function Signatures
← Back to Mojo Academy