syntax return-rw
Documentation for syntax return-rw
assembled from the following types:
language documentation Control flow
From Control flow
(Control flow) control flow return-rw return-rw
The sub return
will return values, not containers. Those are immutable and will lead to runtime errors when attempted to be mutated.
sub s();say ++s();CATCH ;# OUTPUT: «X::Multi::NoMatch.new(dispatcher …
To return a mutable container, use return-rw
.
sub s();say ++s();# OUTPUT: «42»
The same rules as for return
regarding phasers and control exceptions apply.