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;| 0 | 1 | |
| 0 | 7 | |
| 1 | (Any) | The program wants to print y, which was never set |
| 0 | an error |
Course navigation
← Default values | A point class →