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

Course navigation

Quiz — Functions with default values   |   Solution: Function to compute

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