0
var someVar:[String] = [] 

var someVar = [String]()

What is the difference beetween this?

Hamish
  • 78,605
  • 19
  • 187
  • 280
  • with the first option you have **type safety** with the 2nd one you have **type inference**. See [here](https://stackoverflow.com/questions/37707403/what-is-the-difference-between-type-safety-and-type-inference/37707404#37707404) – mfaani Jan 17 '17 at 19:53
  • Nevertheless in most cases you should trust the compiler (inference) more than yourself (safety) ;-) – vadian Jan 17 '17 at 19:57

0 Answers0