Help for this page

Select Code to Download


  1. or download this
    class Dot {
        has $.x;
    ...
    
    my $a = Dot.new(x => 23, y => 42, z => 2);
    say $_ for $a.get;
    
  2. or download this
        # Blindly accept x and y, but do extra checks on z:
        submethod BUILD(:$!x, :$!y, :$z) {
    ...
            die "z too big!" if $z > 10;
            $!z = $z;
        }