30 days of code in Go: Day 8 - Dictionaries and Maps
Hi there! The task of today will be coding a phone book. The program reads an integer NN that represents the number of people in the phone book. After that, it reads the NN entries from standard output and generates the dictionary/map. For newbies: dictionaries are the same as maps. Java usually calls the structure with (key, value) pairs as a map, while Python calls it a dictionary. After having the phone book generated, the program will read an unknown number of names. The fact that we can query as many names as we want means that the program needs to check for an end of file before leaving, which is basically trying to read until the user cancels the program. Well, other options would be typing a special quit command, but that’s not the case for this problem. ...