0
Plz give me an example script
I want ask yes or no to the user and if the input is yes execute next step. Else if input is no print retry and repeat the process.
6 odpowiedzi
0
here you go
https://code.sololearn.com/c9J5W947dD51/?ref=app
edit: slight update after re-reading your question
0
I want to repeat the process if input is no
0
revisit the code. I updated after I re-read your question
0
Type in "yes" or "no"
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Unknown Source)
at Program.main(Program.java:12)
It shows error
0
that's because you didn't provide a new line as input. take the example out of the playground and into an actual console.
Plus you have to specify what will happen when neither of those options are typed in
0
I got it tysm!