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

A changeable label

Problem

Define a class Label with a single attribute text that can be changed (is rw). Create a label with the text draft, then append (revised) to its text through the accessor — without re-creating the object — and print the result.

Example

The program prints:

draft (revised)

Solution

See the solution

Course navigation

Solution: A book   |   Solution: A changeable label