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