- Edited
when i use if its says that it needs a Expected conditional expression after "if".
and I dont know what to put in there
when i use if its says that it needs a Expected conditional expression after "if".
and I dont know what to put in there
Post the code and the exact error message.
If you have never programmed before I recommend reading through a Godot or Python introduction. This is not something you can guess your way through, and tutorials in my opinion will leave gaps. Better to take an intro class.
I believe this is a pretty good explanation: https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html#if-else-elif
maty64 the "if" needs to make something happen. So you're likely missing a line of code somewhere. If you don't, your program doesn't know what to do after that condition (IF) occurs. Basically:
if _myVariable == 0:
### this is where what needs to happen happens
This; "Expected conditional expression after "if"." keeps appearing
G_Godot147741 you need something after the if. A comment isn't enough. If you don't want to do anything, put "pass".
Like this:
if _myVariable==0: pass
You can learn more about "if" there: https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html#if-else-elif
This behavior (needing something to do, a comment not being enough) is a design shared by Python. You can find a good discussion there:
https://stackoverflow.com/questions/51913755/when-is-pass-necessary-in-a-python-if-statement