+ 1

What does (y*=-1) mean?

confused about the relevance of the -ve sign.

15th Jul 2018, 5:41 PM
Dhrubajyoti Mandal
Dhrubajyoti Mandal - avatar
2 Réponses
+ 4
Multiplied with itself by minus one. So making it negative basically. short form for y = y * (-1)
15th Jul 2018, 5:43 PM
Matthias
Matthias - avatar
+ 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
25th Jul 2018, 4:14 PM
Seniru
Seniru - avatar