Course of Raku / Advanced / Operators / Review of operator behaviour / Exercises / Power tower

Solution: Power tower

Here is a possible solution to the task.

Code

say 2 ** 2 ** 3;

🦋 You can find the source code in the file power-tower.raku.

Output

256

Comments

  1. Because ** is right-associative, the expression groups as 2 ** (2 ** 3).

  2. That is 2 ** 8, which is 256 — not (2 ** 2) ** 3, which would be 64.

Course navigation

Power tower   |   Chained comparison