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
- Positional and Keyword Arguments
- Default Argument Values
- Returning Multiple Values
- Reading Function Signatures