#java help

1 messages · Page 1 of 1 (latest)

plain fractalBOT
#

<@&987246399047479336> please have a look, thanks.

plain fractalBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

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.

fickle wagon
#

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

wise orchid
#

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 ==

wise orchid
#

Since you are dealing with ints which are primitive, no, == will suffice. With strings or other objects, you would.

fickle wagon
#

NO LUCK

#

no luck*

#

sorry

worldly heart
#

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

uneven depot
#

duplicate of #1072705373154312294

plain fractalBOT
#

Closed the thread.

fickle wagon
#

still does not work

tulip dock
#

your if condition is different in the while loop

worldly heart
#

you have to use && in the while loop not ||

#

because !(A || B) <=> !A & !B

fickle wagon
worldly heart
#

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

fickle wagon
worldly heart
#

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

fickle wagon
#

ohh

#

i see

#

thanls

#

works now

#

and i made it a while loop

worldly heart
#

yes, does it work now?

fickle wagon
#

yup ty

plain fractalBOT
#

Closed the thread.