0

How do you stop the code from executing (error)?

5th Apr 2018, 8:10 AM
mei
mei - avatar
6 Answers
+ 3
if it's just code embed it in a try, if it's loop break statement might work if it's a function,return statement will stop it's executing further
5th Apr 2018, 8:33 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 3
@mei, I think you need to add a link to the troubling code into your original question (on top), until now everyone here are shooting blanks trying to help you, until there is a code for them to see, it will be a mystery what issue you are dealing with. Create, or open (if you already have it) in Code Playground, save any changes, and share code link by tapping share button on top of code editor, choose copy to clipboard, paste the link on your original question. P.S. Please do fix your question tags, your recent post indicated JavaScript, then remove Java from tag to not confuse people what language was the question about.
6th Apr 2018, 7:05 AM
Ipang
+ 1
For Java, you can put this at the bottom of the catch block: System.exit(0) It will exit from the code. Example: int a = 5; int b = 0; try { System.out.println(a / b); } catch(Exception e) { System.out.println("(!) Division by zero..."); System.exit(0); }
5th Apr 2018, 11:22 AM
Boris Batinkov
Boris Batinkov - avatar
0
So what code is it for the return statement?
5th Apr 2018, 11:10 AM
mei
mei - avatar
0
JavaScript
6th Apr 2018, 6:15 AM
mei
mei - avatar