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
-1024Solution
Course navigation
← Quiz — Functions with default values | Solution: Function to compute xʸ →
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська