help with ++
#1

i saw alot of times stuff like this... (Var is an example
Код:
Var[playerid] ++;
can someone plz explain what does it do?
Reply
#2

it does this:
pawn Код:
Var[playerid] = Var[playerid] + 1;
a.k.a. adds 1 to the value.
Reply
#3

Quote:
Originally Posted by xDeadlyBoy
Посмотреть сообщение
it does this:
pawn Код:
Var[playerid] = Var[playerid] + 1;
a.k.a. adds 1 to the value.
so can i just do Var[playerid] += 1;
??
Reply
#4

or you can do Var[playerid]++;
it's all the same.
Reply
#5

Quote:
Originally Posted by xDeadlyBoy
Посмотреть сообщение
or you can do Var[playerid]++;
it's all the same.
ok... thx!
Reply
#6

Ther are more, should you care:

PHP код:
Var = Var + 1// Variable + 1 (add)
Var++; // Variable + 1
Var += 1// Variable + 1
Var = Var - 1// Variable - 1; (substract)
Var--; // Variable - 1;
Var -= 1// Variable - 1;
Var = Var * 1// Variable * 1; (multiply)
Var *= 1// Variable * 1;
Var = Var / 1// Variable / 1; (divide)
Var /= 1// Variable / 1;
Var = Var & 1// Variable with bitwise "and" (concatenate 1 bit)
Var &= 1// with bitwise "and"
Var = Var | 1// Variable with bitwise "or" (concatenate 1 bit)
Var |= 1// with bitwise "or" 
Hope that helps.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)