Symbols Exercise

In case you get stuck anywhere, don't be afraid to ask the coaches! They are here to help and will gladly explain everything to you!

Take notes during the exercises. Even if you never look at them again, they will help you memorise things!

We are going to make a dictionary for whatever two languages you know. The key is always a word or expression in the source language, whereas the value is a word or expression in the target language.

  1. Create a new file in your directory

  2. Create an empty hash

  3. Add at least seven key and value pairs: They key should be a symbol and the value a string­

    e.g. The German translation for :ruby is "Rubin"

  4. Access the value of a certain key

  5. Check if a certain value is in your hash. Try with one value that is in the hash and with another that is not

  6. Delete one key-­value pair from your hash

  7. Find the key for a certain value

  8. Find the keys for all values which start with certain characters, e.g. A, Ba, Rub