Course of Raku / Essentials / Built-in functions for printing / Exercises

Print the warning

Problem

Create a program that asks for your age and prints one or two warnings if the entered value is negative. Make sure the warning is printed to STDERR.

Example

A couple of possible cases:

$ raku print-the-warning.raku
What is your age? 20
Your age is 20

$ raku print-the-warning.raku
What is your age? -1
You entered a negative number!

Solution

See the solution

Course navigation

More about functions / Multi-functions   |   The MAIN function