Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: [Raku] Assigning defaults to attributes that are fixed length lists (and other confusions)

by duelafn (Parson)
on Apr 28, 2021 at 13:01 UTC ( [id://11131790]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    Name: Christmas Basket
    Items: Array.new(:shape(3,), [Any, Any, Any])
    
  2. or download this
    class Hamper {
        has $.name = 'Christmas Basket';
        has Str @!items;
    ...
    
    say "Name: " ~ $hamper.name;
    say "Items: " ~ $hamper.items;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11131790]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-23 20:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found