Hi all,
Just a quickie, I want to increase a variable by 3 each time it is ran in a loop;
I know variable++ increases by one each time, how would i get it to increase by 3??
Thanks guys
Boontune
Hi all,
Just a quickie, I want to increase a variable by 3 each time it is ran in a loop;
I know variable++ increases by one each time, how would i get it to increase by 3??
Thanks guys
Boontune
variable += 3;
Thanks Mate!!
boontune - You may already know this... but new programmers can be confused by this:
MyVariable = MyVariable + 3 ; // Bad in math. OK in programming!
In programming, this is an ASSIGNMENT (Assigning a new value to MyVariable). it's not an equation!
For simple operations polymorphic OOP's example is the standard "C++ way" of doing it. But, it is common to see the left-side variable repeated on the right side of the assignment statement.