Mathematical Expression
- 1 + + 1 results 2
 - 1 + - 1 returns 0
 - 1 + - + 1 returns 0
 
can anybody know the reason of this. because I only know ++ -- operation but in this case the operator is '+ +' and still not giving an error.
Mathematical Expression
can anybody know the reason of this. because I only know ++ -- operation but in this case the operator is '+ +' and still not giving an error.
Its because + is also a unary operator which means positive, just like - means negative.
1 + + 1 =   1 + (+1)  = 1 + 1  = 2
1 + - 1 =   1 + (-1)  = 1 - 1  = 0
1 + - + 1 = 1 + -(+1) = 1 + -1 = 1 - 1 = 0;