Course of Raku / Objects, I/O, and exceptions / Classes and objects / Attributes / Default values

Quiz — Attributes

What does the following program print?

class P {
    has $.x = 7;
    has $.y;
}

say P.new(x => 1).y;
01
07
1(Any)The program wants to print y, which was never set
0an error

Course navigation

Default values   |   A point class