What is that means ?
#1

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?
Reply
#2

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
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)