Slackbot
06/28/2022, 10:01 PMLandry Norris
06/28/2022, 10:05 PMLandry Norris
06/28/2022, 10:08 PMLandry Norris
06/28/2022, 10:11 PMAhmed
06/28/2022, 10:29 PMAhmed
06/28/2022, 10:30 PMnum = num++ //The value changed at 'num++' is never used
Vampire
06/28/2022, 10:35 PMnum
after that lineAhmed
06/28/2022, 10:36 PMLandry Norris
06/28/2022, 10:40 PMhfhbd
06/29/2022, 3:49 AMnum++
is a postfix operator and increases num
after the assignment.
var num = 0
num = num++
println(num)
will print 0, because num (0) <=num (0) and then the operation num + 1 is executed, but the result is never used, the assignment is executed before the operation.altavir
06/29/2022, 5:15 AMAhmed
06/29/2022, 2:40 PM