Course of Raku / Essentials / More about types / Typed variables / Exercises

Create variables of all known types

Task

Write a program that creates a few scalar variables and initialises them with the values of the following types: Int, Rat, Num, Bool, and Str. The program should print both the value and its type.

Example

The actual output of the program may differ, but the idea is illustrated with the following test run:

$ raku types.raku
151 (Int)
4.2 (Rat)
1e10 (Num)
True (Bool)
xyz (Str)

Solution

See the solution

Course navigation

Allomorphs   |   Solution: Create variables of all known types

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