exit

The exit statement has the following syntax:

exit;

exit simply ends the execution of the current script function, method, or event. Note there is a slight difference in use here depending on the scope:

When used in an event, exit is typically used to avoid an instance running any further code when a specific condition has been met (or not). The code below outlines an example of how it could be used, in this case within a Collision Event, although it can be used in any event.

if (!visible)
{
    exit;
}

other.hp -= attack;
other.coins -= 4;
coins += 4;

The above code checks if the current instance is not visible, in that case it exits the code block, otherwise it goes ahead and runs the rest of the code.

NOTE It does not end the execution of the game. For that you need to use the function game_end().