Raku-Kurs / Grundlagen / Assoziative Datentypen / Interpolation von Hashes
Quiz — Interpolation von 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.
<β> | say "The letter β is called %letters␣␣."; |
2
Using the hash, print the name of the Greek letter β
. Use the form where the key is quoted in single quotes.
{'β'} | say "The letter β is called %letters␣␣␣␣."; |
3
Print the letters and their names as a table.
letters{ | say "Here are some Greek letters:\n%␣␣␣␣␣}\netc."; | Note that the output may be not sorted. |
The possible output for this case is:
Here are some Greek letters:
α Alpha
β Beta
γ Gamma
etc.
Kursnavigation
← Assoziative Datentypen / Verschachtelte Hashes | 💪 Übungen: Assoziative Datentypen →
Diese Seite wurde automatisch mit ChatGPT 4o übersetzt. Originaler englischer Text.
Übersetzungen dieser Seite: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська