Course of Raku / Essentials / Creating and calling functions / Exercises
Odd or even
Problem
Create a function that takes an integer number as an argument and returns the string 'Odd' or 'Even'. Write a program that uses this function to print the property of a few numbers, for example, 10, 5, 0, and 3.
Example
For the given numbers, the program is expected to print the following:
$ raku odd-or-even.raku
Even
Odd
Even
Odd
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 • Български • Русский • Українська