Cursus Raku / Elementa / 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.
Cursus navigatio
← Associativa data genera / Nidificata hashes | 💪 Exercitationes: Associativa data genera →
Haec pagina automatice translata est per ChatGPT 4o. Originalis Anglicus textus
Translationes huius paginae: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська