Ask coding questions

← Back to all posts
How do i stop the script in my game?
seth08g (1)

Hey I know what process.exit(0) is but I want to stop the script there not end the whole thing. Is that possible? please help thanks...

Answered by Coder100 (18882) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18882)

Use the return function to exit a function. Other than that, there is no way to exit a specific part.
So something like this:

function exitEarly() {
  if (... == true) return;
  ...
}

exitEarly();
SixBeeps (5331)

You only have one script, so stopping the script would stop the whole thing. Did you want to stop the function?

seth08g (1)

I want to stop the script on lines 20 and 86