I am struggling to understand why my code will not exit when I tell it to. I want the program to terminate when I tell it to. But in my block of code where I tell it to, it just ignores it then moves onto the next line of code. For example: (here is part of my code):
if (newNum - userNum == 0) {
System.out.println("You loose!");
System.exit(0);
return;
}
//computer picks
comPick = drawNum();
newNum = newNum - comPick;
System.out.println("The computer picks " + comPick + " number. There are " + newNum + ".");
if (newNum - comPick == 0) {
System.out.println("You win! Computer Loses!");
System.exit(0);
return;
}
When newNum - userNum equals zero it just skips over all of my code and moves onto the next block. Does anyone have any suggestions for me? Thanks in advance!