#!/usr/bin/env swift; import Foundation import Utils // Begin Main var dictionary:[String: String] = [:] print("dictionary size: " + String(dictionary.count)) print("dictionary is " + (dictionary.isEmpty ? "empty" : "not empty")) dictionary["apple"] = "red" dictionary["banana"] = "yellow" dictionary["cantaloupe"] = "orange" dictionary["dragonfruit"] = "red" dictionary["elderberry"] = "purple" print("dictionary size: " + String(dictionary.count)) print("dictionary is " + (dictionary.isEmpty ? "empty" : "not empty")) print("bananas are " + dictionary["banana"]!) var x:String = "dragonfruit" if dictionary.keys.contains(x) { print(x + " are " + dictionary[x]!) } else { print("Can't find " + x) } x = "fig" if dictionary.keys.contains(x) { print(x + " are " + dictionary[x]!) } else { print("Can't find " + x) } x = "elderberry" dictionary.removeValue(forKey: x) if dictionary.keys.contains(x) { print(x + " are " + dictionary[x]!) } else { print("Can't find " + x) } print(Utils.mapToString(dictionary)) exit(EXIT_SUCCESS)