Expected else after ternary if.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DinoFranx

when i write this code

if Move.x != 0:

I get Expected else after ternary if.
what am I doing wrong? help it’s 12 at night and I don’t know how to fix the error :frowning:

You’ll probably need to give more context. What is the rest of the code around this line?

kidscancode | 2022-07-17 04:44

:bust_in_silhouette: Reply From: USBashka

Ternary operator, as the name says, takes three arguments:

"True" if condition else "False"

So you can’t use it without else. I would add some advice, but you didn’t provide enough info. Maybe you need to use regular if statement. See the difference in the docs.