+ 3
How can i declare +
When i make: if ( g = + ) it makes error Can i somehow declare +
4 Respuestas
+ 11
Try if(g=='+') { ...... }
Now I may work as in the if condition, you should use ==(comparison operator) and plus sign (+) is evaluated as a character so it should be surrounded by single quotes (' ').
Hope this helps.
+ 5
Just a question, are you testing if variable g is equal to character + ?
If yes, write :
if(g=='+')
{
}
+ 3
if (g = +)
is thinking the + sign is a Operater doing something, And = is the assignment Operater. == Is telling if it is Equal to that Value;
Change it into a String(Text)
and change the = to ==:
if(g == “+”)
then your code is okay again!!
+ 2
Thanks guys :*