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

Interval function

Problem

Create a program that implements a function according to this definition:

Print the result of the function for the arguments -2, 0, and 3.

Example

The program should print the following output:

$ raku interval-function.raku
2
0
2.5

Solution

See the solution

Next exercise

💪 Function table

Course navigation

Associative data types / Interpolating hashes   |   More about functions