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:

Typically exit is used to avoid an instance running a specific block of code in, for example a collision event. The code below gives a simple example of this:

if (!visible)
    {
    exit;
    }
while (place_meeting(x, y))
    {
    x -= lengthdir_x(1, direction - 180);
    y -= lengthdir_y(1, direction - 180);
    }

The above code checks a variable and if it resolves to true, then 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().