Tour · 3 of 25
A public signature is a contract, checked on both sides
A public function spells out its parameter types and its result type. Inside
the body, types are inferred: base is an i32 without saying so. Because the
contract is written down, a mistake in the body is reported in the body, not at
every caller, and a caller that passes the wrong type is stopped at the call.
Parameters may have defaults, and a named argument such as express=true says
what a bare true would hide.
Run: Ctrl+Enter · Pages: Alt+← Alt+→