In Format§

See primary documentation in context for method arity

method arity(--> List:D)

Returns the minimal number of positional arguments that is needed for this format. Intended for introspection purposes.

use v6.e.PREVIEW;
my $d = Format.new("%05d%3x:%s");
say $d.arity;                   # OUTPUT: «3␤» 

In ForeignCode§

See primary documentation in context for method arity

method arity()

Returns the arity of the enclosed code.

In Signature§

See primary documentation in context for method arity

method arity(Signature:D: --> Int:D)

Returns the minimal number of positional arguments required to satisfy the signature.

In Code§

See primary documentation in context for method arity

method arity(Code:D: --> Int:D)

Returns the minimum number of positional arguments that must be passed in order to call the code object. Any optional or slurpy parameters in the code object's Signature do not contribute, nor do named parameters.

sub argless() { }
sub args($a$b?{ }
sub slurpy($a$b*@c{ }
say &argless.arity;             # OUTPUT: «0␤» 
say &args.arity;                # OUTPUT: «1␤» 
say &slurpy.arity;              # OUTPUT: «2␤»