Understanding swift dictionaries?

Example:


  var ages = ["John": 30, "Jane": 25]
  print(ages["John"])  // Outputs: Optional(30)
  

Solution:

Dictionaries are collections of key-value pairs. You can access the value of a dictionary using its key.

Beginner's Guide to Swift