Version: 1.1.0
How to read the API docs
A Mojo signature puts compile-time parameters in square brackets and runtime arguments in parentheses.
Essentials
fn name<a href="/arg: Type/">param: Type</a> -> Resultis the full form.- A slash or star in an argument list marks positional-only or keyword-only arguments when the page shows them.
- Traits in the parameter list are requirements, not extra arguments.
raisesmeans the call can fail.- Stability badges say whether the signature is allowed to change.
Example
fn scale[n: Int](read x: SIMD[DType.float32, n]) -> SIMD[DType.float32, n]:
return x * 2
Keep in mind
Read the parameter list before the argument list. Mixing them up is the usual reason a call will not compile.