Course of Raku / Advanced / Operators / Traits and pragmas 🆕 / Built-in traits

Quiz — Traits

Which trait lets a subroutine change the caller’s variable through a parameter?

1is rw
0is copy
0is default
0none — parameters are writable by default

A parameter is read-only by default, so a plain one cannot be assigned to. is rw binds the parameter to the caller’s own variable, so a change inside the routine is visible outside. is copy would instead give a modifiable copy, leaving the caller untouched.

Course navigation

Built-in traits   |   Writing a trait