learn-swift icon indicating copy to clipboard operation
learn-swift copied to clipboard

Tuples type inferrence

Open jcavar opened this issue 9 years ago • 0 comments

Hi, In tuples example there is this example:

// We can also specify the type in order to avoid inferrence let someOtherTuple = (Double(100), Bool(false))

I think comment for example is not true because type of someOtherTuple is still inferred from content. Right example for this comment would be:

let someOtherTuple: (Double, Bool) = (100, false)

In this way we are avoiding inferrence and we will get error if we specify content with wrong type.

jcavar avatar Apr 02 '15 06:04 jcavar