Increase a number by 50 instead of 1 using the increment operator
I am trying to increase a number using the increment
++ operator. But I don’t want to add 1 every time the function executes. I need the number to raise by 50 each time the function executes. How do I do this?
I get an error when I try
x++y(x base number, y is 50) or x++50
You can’t change how much
++ will increment a number.
However, you could use
x += 50 which is shorthand for
x = x + 50.