Ask coding questions

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

In my game there is a question at the start, asking if you want to play it or not. If they say no, then I want to stop the script, but I don't know how to do that. Does anybody know? Would appreciate the help :).

Answered by Coder100 (19277) [earned 5 cycles]
View Answer
Coder100 (19277)

you can use the return; statement to terminate a function early.
You can also use process.exit(0); to stop the whole repl altogether.

seth08g (1)

Thanks to Coder100 (18203) he/she really helped me!