#java help
1 messages · Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
whenever i add continue or break
in the if statement it errors
how do i make it so the 2 breaks it out of the loop
Currently, your "while" condition requires userInput to be equal to 1, 2, 3, and 4, which is not possible.
I think, to get the result you want, you need to replace each != with ==
do i need .equal?
Since you are dealing with ints which are primitive, no, == will suffice. With strings or other objects, you would.
Ur while condition is wrong
It has to be that user input is none of 1 2 3 4
Also u can replace the if else and do while with a single while
duplicate of #1072705373154312294
Closed the thread.
so
still does not work
your if condition is different in the while loop
so what should i change the while loop condtion to?
change the ors to &&s
and remove the if else bit completely
replace the do while with a while loop
that removes the need of using an if else
can you explain why this works
see
we have the condition that user input can be is 1 or 2 or 3 or 4
and we need to negate that
so if i were to ask u
give me a number that is ≠ 1, ≠2, ≠ 3 and ≠ 4
yes, does it work now?
yup ty
Closed the thread.