Variables IV
Dictionary
Variables IV
Dictionary
0
0
Checkbox to mark video as read
Mark as read

What is a Dictionary?

A Dictionary is similar to an Array, it's a list of items, but in this case, it's unordered, and we define the index ourselves.

This means that a Dictionary is composed of a list of pairs where one component is the Key, and the other is the Value.

A Dictionary is declared similarly to an Array, but the Key-Value pairs are separated by colons. When specifying the type, we define the type of Key (on the left), and the type of Value (on the right).

var ages: [String: Int] = ["Pablo": 23, "Andrea": 21, "Miguel": 24]
var products: [Int, String] = [2341: "Pants", 33454: "Blouse", 2345: "Socks"]

Continue reading

Access to all the content with our plans.

Basic Plan

FREE

Start Now
  • Junior level content
  • Senior level content
  • Expert level content
  • Extra content
  • Question submissions
Monthly
Yearly

Plan logo

-

Unlimited access to the whole content

  • Junior level content
  • Senior level content
  • Expert level content
  • Extra content
  • Question submissions

Stripe secure payment methods
Plan logo

-

Unlimited access to the whole content

  • Junior level content
  • Senior level content
  • Expert level content
  • Extra content
  • Question submissions

Stripe secure payment methods
Plan logo

-

Solve your doubts at any level

  • Junior level content
  • Senior level content
  • Expert level content
  • Extra content
  • 2 Question submissions per week

Stripe secure payment methods
Plan logo

-

Solve your doubts at any level

  • Junior level content
  • Senior level content
  • Expert level content
  • Extra content
  • 2 Question submissions per week

Stripe secure payment methods

0 Comments

Join the community to comment
Sign Up
I have an account
Be the first to comment

Accept Cookies

We use cookies to collect and analyze information on site performance and usage, in order to provide you with better service.

Check our Privacy Policy