The break keyword in most programs, including Godot, stops the execution of an if statement or a for, while or any iterative loop. To ‘break’ out of a function, just use the return keyword.
func _ready():
if some_condition:
print("true")
else:
return # breaks execution of the entire function
print("test")
Please note that according to your code fragment, this would either print out both true and test, or neither at all.
Sorry if my replying here causes trouble but I want to point out a mistake
The answer above is not correct, maybe I’m a newbie or something, I don’t think break would stop execution of if statement: Does it?
If someone is learning coding and run into here, better double check somewhere else.