Positional and Keyword Arguments
Send values by position or by name.
Two Ways to Pass Values
Every Mojo function call sends in values called arguments. You can send them by position or by name, and both styles can live in one call.
Positional Arguments
With positional arguments, order is everything. The first value fills the first parameter, the second fills the second, and so on.
fn greet(name: String, times: Int):
for _ in range(times):
print(name)
greet("Mojo", 2)All lessons in this course
- Positional and Keyword Arguments
- Default Argument Values
- Returning Multiple Values
- Reading Function Signatures