+x as well as ++x do not produce any warning.
These statements do nothing, as there is no pre-increment operator in GDScript.
x does not even need to be defined.
The same holds true for --x, however here x needs to be defined for it to not produce an error.
This is very confusing. This should not compile and do nothing silently, but rather print a compile error.
Furthermore, there seems to be more weirdness with operators:
x + + 1 not only compiles without any warning or error, it does... nothing.
The only real bug is that the positive operator (+x) is ignored by the compiler, that's why it doesn't complain the variable is not defined.
The others can be added as warnings when I get to #18271.
Related bug from #29549: using x++ will produce a misleading warning:

in gdscript ++, -- are not operators and gdscript behaves exactly like python (this issue may closed)
>>> x = 1
>>> ++x
1
>>> -+-+-x
-1
>>> x++
SyntaxError: invalid syntax
fixed:
x does not even need to be defined.
I reckon just adding a warning for this would be a good idea. Plenty of us are coming to GDScript from C-like languages.
in gdscript ++, -- are not operators and gdscript behaves exactly like python (this issue may closed)
@ThakeeNathees
I don't see why behaves like Python should end all discussion. Sure, Python is a nice language that is a good source of inspiration, but if we wanted Python exactly, we could just go with Python.
Not having pre- or postincrement operators is fine.
Silently doing nothing for a highly common operator in other languages due to the language specifics is, IMO, dubious at best. Depending on your code, this may be a source of hard to find bugs.
Indeed, the web is full of people that have been bitten by this in Python:
Stackoverflow yields ~1400 results about Python and preincrement alone.
The Python linter pylint even has its own error check for this:
http://pylint-messages.wikidot.com/messages:e0107
Used when you attempt to use operators that do not exist in Python.
One example are the C-style pre- or post- increment or decrement operators — and ++, which don't exist in Python
A warning for this, if possible, would be really nice.
A warning for this, if possible, would be really nice.
I think it makes more sense to throw a parse error rather than a warning for this particular case.
By the way, even in Python the situation seems more because of keeping backwards compatibility for idioms like Decimal("1.9")++Decimal("1.5") (which I've personally not seen used that much, but anyway), which I don't think is the case with GDScript - and we don't strive for backwards compat quite like Python, I think (well, besides the Python 2 -> 3 thing).
Indeed, there is a CPython core dev suggesting raising a SyntaxError in this case here:
https://discuss.python.org/t/why-compiler-doesnt-support-in-de-crement-operation-should-we-support-it/2181
And there is a Pull Request where they discussed it, although it was ultimately rejected due to the backwards compat issue mentioned above:
https://github.com/python/cpython/pull/18297
Edit: also, I feel like gamedev is one area where preincrement operator usage is still somewhat widespread, in contrast to the rest of the industry.
Most helpful comment
@ThakeeNathees
I don't see why behaves like Python should end all discussion. Sure, Python is a nice language that is a good source of inspiration, but if we wanted Python exactly, we could just go with Python.
Not having pre- or postincrement operators is fine.
Silently doing nothing for a highly common operator in other languages due to the language specifics is, IMO, dubious at best. Depending on your code, this may be a source of hard to find bugs.
Indeed, the web is full of people that have been bitten by this in Python:
Stackoverflow yields ~1400 results about Python and preincrement alone.
The Python linter pylint even has its own error check for this:
http://pylint-messages.wikidot.com/messages:e0107
Used when you attempt to use operators that do not exist in Python.One example are the C-style pre- or post- increment or decrement operators — and ++, which don't exist in PythonA warning for this, if possible, would be really nice.