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

A reversed word

Problem

Define a class Word with a text attribute and a method reversed that returns the word’s text spelled backwards (the flip method reverses a string).

Create a word holding Raku and print its reversal.

Example

The program prints:

ukaR

Solution

See the solution

Course navigation

Solution: A walking robot   |   Solution: A reversed word