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 (18915) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18915)

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!