0
Operations question
var a = 19, b = 4 b /= a print(b) Result: 0 Why is this 0? Is it because 4/19 is less than a whole number?
1 Answer
+ 3
This is Swift. When both operands are integers, division rounds the result to the nearest integer towards zero. In other words, the result is truncated.