Charlie Brown
11/27/2020, 7:09 AM//Consider the code snippet below. What will it print?
var num = 0
println(num++ + ++num)
Here is my step
num++ + ++num (num = 0)
num++ + 1 (num = 1)
1 + 1 (num = 1)
Am i correct?Charlie Brown
11/27/2020, 7:10 AMJames Richardson
11/27/2020, 8:06 AMTobias Berger
11/27/2020, 8:22 AM2
either way. It's either 1 + 1
or 0 + 2
and after execution, the value of num
will also be 2
in both cases.Tobias Berger
11/27/2020, 8:25 AMCharlie Brown
11/27/2020, 8:44 AMnanodeath
11/27/2020, 3:58 PMWrite a test that checks the behaviour of your code.