Course of Raku / Essentials / Creating and calling functions / Exercises
Function to compute xʸ
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 5³, 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
Next exercise
Course navigation
← Associative data types / Interpolating hashes | More about functions →
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська