I'm wondering why the below code generates the strange results, and compiler doesn't show any error or warning. This looks like an extremely efficient source of bugs.
val a = 10 * 20 +
10 * 30
val b = 10 * 20
+ 10 * 30
val c = (
(10 * 20)
+ (10 * 30)
)
val d = (10 * 20)
+ (10 * 30)
println(a)
println(b)
println(c)
println(d)
And the output is:
500
200
500
200