integer deduction

Started by timlump, Wed 29/11/2006 22:24:05

Previous topic - Next topic

timlump

sorry about my rather abrubt and noobish question but how do i deduct integers e.g
int=20

how do i deduct 1
so that if i run a script 1 is deducted.
Thanks in advance

strazer

int myvariable = 20; // define an integer variable named myvariable and initialize it to 20

myvariable = myvariable - 1; // subtract 1 from myvariable's current value
myvariable--; // shorter version of the above
myvariable -= 1; // another alternative

myvariable = myvariable - 3; // subtract 3 from myvariable's current value
myvariable -= 3; // shorter version of the above

timlump

thanks im very appreciative of your help.

strazer


SMF spam blocked by CleanTalk