![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | throwcode |
Hi I just received the following error:
res://Scripts/Game.gd:142 - Parse Error: Expected else after ternary if.
The respective code appears like this:
func saucer_destruction(pos):
var s = expl_saucer.instance()
var num = Controller.get_numSaucers() - 1
if num <= 0 :
$FlyingSaucer.queue_free()
the “if num <= 0 :” is line 142 and failing with the error message above.
What am I doing wrong, this looks like a standard if statement to me.
TC
Make sure the whole script uses the same indentation (tabs or spaces, don’t mix them) and that there are no special characters inserted as a result of copy-pasting (such as non-breaking spaces).
Calinou | 2019-05-18 14:30
You can get this error by forgetting a parenthesis on a variable just above the if statement. It thinks that you are continuing the var line.
GIngerageous | 2020-01-08 06:22
thanks @Gingerageous : that was my problem
BakouKai | 2021-04-10 14:11