Named Arguments
named arguments
named_arguments in ~90 seconds.One touch and the Code Pyramid’s ancient rune torches flare to life, but the magic only works if you speak the exact right words in any order.
Named arguments let you pass values into a function by their exact name instead of their position, and you can even set default values so optional parameters just fill themselves in.
We define our rune function with a required glyph string and an optional glow float that defaults to one, then call it by naming each argument with the assignment operator — notice how the glow comes first, proving order doesn't matter.
Reach for named arguments when a function has multiple settings or optional tweaks, keeping your code readable no matter how many parameters you add.
pyramid_device := class(creative_device):
ActivateRune(?Glyph: string, ?Glow: float = 1.0): void =
Print("Rune activated")
OnBegin<override>()<suspends>:void =
ActivateRune(?Glow := 2.5, ?Glyph := "Sun")
Build your own lesson with named_arguments
Generate a personalized, compile-checked lesson grounded in this exact reference.
Build a lesson →