What is that means ? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What is that means ? (
/showthread.php?tid=424006)
What is that means ? -
yaron0600 - 20.03.2013
Hey I'm learning how to script but just tell me whats this means :
playersconnected
++;
the ++ why to use this ?
And what is that ?
playersconnect
+= 1;
Why to use += 1?
Re: What is that means ? -
gtakillerIV - 20.03.2013
playersconnected++;
Will increase the value of "playersconnected" by 1.
Why to use += 1?
It'll do the same thing as "playersconnected++", since you entered 1.
Using += 20 will increase the value of "playersconnected" by 20.
They are called Assignment Operators by the way.
Код:
Operator
= Simple assignment operator, Assigns values from right side operands to left side operand C = A + B will assign value of A + B into C
+= Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand C += A is equivalent to C = C + A
-= Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand C -= A is equivalent to C = C - A
*= Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand C *= A is equivalent to C = C * A
/= Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand C /= A is equivalent to C = C / A
%= Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand C %= A is equivalent to C = C % A
<<= Left shift AND assignment operator C <<= 2 is same as C = C << 2
>>= Right shift AND assignment operator C >>= 2 is same as C = C >> 2
&= Bitwise AND assignment operator C &= 2 is same as C = C & 2
^= bitwise exclusive OR and assignment operator C ^= 2 is same as C = C ^ 2
|= bitwise inclusive OR and assignment operator C |= 2 is same as C = C | 2
Re: What is that means ? -
rishabh1x - 20.03.2013
The ++ is increment operator it will increase the value by 1....
And += is left hand assignment operator
Playersconnect+=1 will do same like
Playersconnect=playersconnect+1