#Cant figure out why my program doesn't catch a specific error.
1 messages · Page 1 of 1 (latest)
ye, you were missing the return; keyword
these comments are obscuring the code more than helping
yes, it's completely fine
k, follow the rules then! 😅
You can change
if (baseInputField.getText().isEmpty() || exponentInputField.getText().isEmpty()) {
outputArea.setText("Please input a number for both the base and the exponent.");
return;
} else {
baseValue = Double.parseDouble(baseInputField.getText());
exponentValue = Double.parseDouble(exponentInputField.getText());
}
to
if (baseInputField.getText().isEmpty() || exponentInputField.getText().isEmpty()) {
outputArea.setText("Please input a number for both the base and the exponent.");
return;
}
baseValue = Double.parseDouble(baseInputField.getText());
exponentValue = Double.parseDouble(exponentInputField.getText());
A single comment here may be enough
yes