;

PDA

Click to See Complete Forum and Search --> : yet another question (its a small one)


cyber reaper
04-17-2004, 06:19 AM
i created two buttons ,one wich increase a number at the edit box
by 1 and the other wich decreaseit by 1 (i used ++ command)
however when i tried to make the buttons to increase/decrease by 2
they where still increasing/decreasing by 1 and now the each one
of them increases/decreases two different numbers (for ex:i clicked on the increase button 4 times-the number increased to 5 but then
i clicked on the decrease button and the number returns to 1)
(i used the command : text = ++2)

in other words my question is how to make and increasement/decreasement by more then 1 ?

blanius
04-17-2004, 07:16 AM
to increase by 2 use +=2

for a variable named myvar you

myvar+=2
(decrease is -=2)

Or if you want it to be easier to read just

myvar=myvar+2
(decrease is myvar=myvar-2)