+ 1
What does (y*=-1) mean?
confused about the relevance of the -ve sign.
2 Answers
+ 4
Multiplied with itself by minus one. So making it negative basically.
short form for
y = y * (-1)
+ 4
You can use this shorthand syntax for many operators too.
x += 1 //x = x + 1
x -= 1 //x = x - 1
x *= 2 //x = x * 2
x /= 3 //x = x / 3
x %= 3 //x = x % 3
The basic idea of this shorthand method is doing operations with a specific value on the variable itself