Post

Replies

Boosts

Views

Activity

How to understand the type conversion in Int + Double?
Extend the example in “The Swift Programming Language” (Swift 5.5) “Integer and Floating-Point Conversion”: 3 + 0.14 // allowed let three = 3 let rest = 0.14 3 + rest // allowed 0.14 + three // compile error three + 0.14 // compile error I don’t understand why the last two lines are taken as compile error. Can anyone help to explain a bit? Thanks.
2
0
411
Oct ’21