In Parameter§

See primary documentation in context for method suffix.

method suffix(Parameter:D: --> Str:D)

Returns the ? or ! marker a parameter was declared with, if any. Otherwise, returns the empty string.

my Signature $pos-sig = :($a, $b?);
say $pos-sig.params[0].suffix; # OUTPUT: «␤»
say $pos-sig.params[1].suffix; # OUTPUT: «?␤»

my Signature $named-sig = :(:$a!, :$b);
say $named-sig.params[0].suffix; # OUTPUT: «!␤»
say $named-sig.params[1].suffix; # OUTPUT: «␤»