#How to see if code produces an error

9 messages · Page 1 of 1 (latest)

cinder flickerBOT
#

Hey, @desert raven!
Please remember to /close this post once your question has been answered!

wicked spade
#

What do you mean with "an error"?

#

If you were to divide by zero with int or long, an ArithmeticException would be thrown, and that would show in the console unless you actively worked to hide it

#

If you were to divide by zerop with float or double, you'd gain an infinity or NaN value. That isn't necessarily taken as an error

coarse ore
#

check with if's if user provided correct input

#

otherwise use try catch block

desert raven
coarse ore
#

try {
code
catch (Exception ex) {
// ERROR
}