Course of Raku / Essentials / Creating and calling functions / Exercises

Function to compute

Problem

Create a function with two arguments that returns the value of $x to the power of $y. Write a program to print the value of , 2¹⁰, and (−4)⁵.

Example

For the above-mentioned values, the program should print:

$ raku function-x-to-the-power-of-y.raku
125
1024
-1024

Solution

See the solution

Next exercise

💪 Odd or even

Course navigation

Associative data types / Interpolating hashes   |   More about functions

Translations of this page: EnglishDeutschEspañolItalianoLatviešuNederlandsБългарскиРусскийУкраїнська