Quick actions

cmd+k|ctrl+k

Navigation

Languages

Using class as sub

Snippet info

Language

Raku

Visibility

public

Author

fernando-correa

Created

2025-12-20T16:27:26.358114Z

Updated

2025-12-20T16:28:58.031463Z

use Test;
use MySub;

my UInt $counter;
my-sub executing-something {
    # say &?ROUTINE; # errors
    $counter++
}

my-sub returning-something {
    "the returned value"
}

# cant parse signature
#my-sub say-answer($answer = 42) {
#    say $answer
#}

executing-something;
is $counter, 1, "it does run the first time";
executing-something;
is $counter, 2, "it does not run the second time";

is returning-something, "the returned value", "it does not return the correct value";

done-testing
INFO