Ask anyone there? If yes then reply hello else if any other reply, ask anyone there? again | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Ask anyone there? If yes then reply hello else if any other reply, ask anyone there? again

Anyone can code this I want to know how it's done I am trying to do it with do while function but it's not working It's printing hello even when the input is not yes I want the program to reply hello when the user types yes

26th Mar 2019, 5:19 PM
kuku Debbarma
kuku Debbarma - avatar
5 Answers
+ 3
I think your condition has to be negative: while(!w.equalsIgnoreCase("yes")) Because you want the loop to run over and over as long as the user *not* inputs 'yes'.
26th Mar 2019, 5:38 PM
HonFu
HonFu - avatar
+ 5
Please show us your code! You can upload it in 'Code Playground' and link it here.
26th Mar 2019, 5:28 PM
HonFu
HonFu - avatar
+ 1
hello thank you for responding and i posted my code it doesnt run in this website but runs in eclispe. also i am a newbie so feed me knowledge all you can! :p
26th Mar 2019, 5:34 PM
kuku Debbarma
kuku Debbarma - avatar
+ 1
Man you are right thanks for the help
26th Mar 2019, 5:41 PM
kuku Debbarma
kuku Debbarma - avatar
26th Mar 2019, 5:33 PM
kuku Debbarma
kuku Debbarma - avatar