Last active
May 31, 2019 19:16
-
-
Save RinniSwift/a37591f8c5a3ad2582ee966c82a8b2bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. empty dictionary initialization | |
var numbers = Dictionary<String, Int>() | |
var newNumbers: Dictionary<String, Int> = Dictionary() | |
// 2. empty dictionary initialization using dictionary literals | |
var nums = [String: Int]() | |
var newNums: [String: Int] = [:] | |
// 3. predefininig elements with dictionary literals | |
var romanNumerals = ["I": 1, "V": 5, "X": 10, "L": 50] // using type inference | |
var romanNums: [String: Int] = ["I": 1, "V": 5, "X": 10, "L": 50] // explicit type declaration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment