Last active
August 29, 2015 14:04
-
-
Save josephlord/07462093db0305b3fd06 to your computer and use it in GitHub Desktop.
Swift Arrays Beta 3 (syntax)
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
| // Note in Swift you usually don't have to state the type it can be inferred but it is useful to be able to do so if you are assigning an empty collection. It can also be necessary in function declarations. | |
| // Beta 1 and 2 | |
| var c:Int[] = [] | |
| // No way of specifiying type really just create the instance of the generic and let type inference define the type of d. | |
| var d = Dictionary<Int:String>() | |
| // Beta 3 | |
| var c:[Int] = [] | |
| var d:[Int:String] = [:] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment