0Pricing
Mojo Academy · Lesson

Parameters vs Arguments

Compile-time values versus runtime values.

Two Kinds of Input

Mojo functions can take two kinds of input: parameters known at compile time, and arguments known at runtime. Knowing the difference is the key.

Arguments Live at Runtime

An argument is an ordinary value you pass when the program runs. Its actual number can change every single time you call the function.

fn square(x: Int) -> Int:
    return x * x

All lessons in this course

  1. Parameters vs Arguments
  2. Parameterized Functions
  3. Parameterized Structs
  4. Why Compile-Time Wins Speed
← Back to Mojo Academy