- or download this
method set( :$x = $.x, :$y = $.y )
- or download this
Named parameters
...
It is an error to pass the arguments as if they were positional.
For example, a call distance(30, 10) generates an error: ...
- or download this
class Rectangle {
has Int $.length = 1;
...
my $r1 = Rectangle.new(length => 2, width => 3);
say $r1.area();
- or download this
has Bool $.done;
- or download this
has Bool $!done;
method done() { return $!done }
- or download this
use v6;
...
$point.set(joe => 100);
say $point; # [100, 20]