Cursus Raku / Elementa / Plura de generibus / Associativa data genera / Interpolando hashes
Quiz — Interpolando hashes
Given the following hash:
my %letters = α => 'Alpha', β => 'Beta', γ => 'Gamma';Complete the below programs to get the requested output.
1
Using the hash, print the name of the Greek letter β.
Use the form without quotes around the key string.
| <β> | dic "Littera β vocatur %letters␣␣."; |
2
Using the hash, print the name of the Greek letter β.
Use the form where the key is quoted in single quotes.
| {'β'} | dic "Littera β vocatur %letters␣␣␣␣."; |
3
Print the letters and their names as a table.
| litterae{ | dic "Hic sunt nonnullae litterae Graecae:\n%␣␣␣␣␣}\netc."; | Nota quod output non ordinatum esse potest. |
The possible output for this case is:
Hic sunt nonnullae litterae Graecae:
α Alpha
β Beta
γ Gamma
etc.