Course of Raku / Advanced / More about built-in types / Strings / Exercises / Reverse and shout

Solution: Reverse and shout

Here is a possible solution to the task.

Code

say 'raku'.flip.uc;

🦋 You can find the source code in the file reverse-and-shout.raku.

Output

UKAR

Comments

  1. The methods are applied left to right: flip first reverses 'raku' into 'ukar', and then uc turns it into 'UKAR'.

  2. Because each method returns a new string, you can chain them in a single expression.

Course navigation

Reverse and shout   |   Acronym