← All generated programs

methods-v1seed 45

methods-00000045.raku

Edit the generated case and press Run. It executes locally in your browser using Raku++.

class Math { method triple($x) { $x * 3 } }
my &operation = Math.^find_method("triple");
my $value = operation(Math.new, 2);

sub safe-str($v) { my $s = try $v.Str; $s.defined ?? $s !! '<undefined>' }
say "TYPE\t" ~ $value.^name;
say "RAKU\t" ~ $value.raku;
say "STR\t" ~ safe-str($value);
say "BOOL\t" ~ $value.Bool;