#control structure switch and if
20 messages · Page 1 of 1 (latest)
Hey, @wooden kernel!
Please remember to /close this post once your question has been answered!
no not that
Okay
it's like
String x = input.next();
switch(x)
{
case "yes":
...
.
.
}
but if the user input "Yes" instead of "yes" it won't work
Then use toLowerCase before the switch
how
Or indeed switch on x.toLowerCase()
what if it was all in uppercase
It will be lowercased
And you just need to switch on lowercase strings
Unless I'm misunderstanding your q
give me an example
Do this and see if works for your use case
it's like
String x = input.next();
String z = input.next.toLowerCase()
switch(z)
{
case "yes":
...
.
.
}
like this?
Right