0
How to iterate a string over switch case?
In switch case, how to check for strings... Is there any specific way or format to check the iteration of strings over switch case,.. Is the same or is there any other way t carry on the same process with if..else.. as well. Explanation with examples are most welcome!!!! First of all thanks for getting into this question.
4 ответов
+ 2
I'm not understanding your question.
If you have a code bit related to this doubt, then share its link so it can be checked.
Just follow below guide to share your code bit link.
https://www.sololearn.com/post/75089/?ref=app
+ 1
Case statements only evaluate results. You can put various possible strings in an array, locate the input, then switch on that.
0
Jerry Hobby
Sir can be explain it a bit more clearly....
If possible do explain it with a suitable example sir!!!
0
@Vishnuvasan Srinivasan
It was fun writing some demo code for you. There are better ways to do this, but SoloLearn doesn't support "vectors". So this is a basic way to do what you asked.
Please check this code:
https://code.sololearn.com/c0a22A25A49A
You can enter multiple commands in input for demonstration. Such as this:
up
down
left
badcommand
right
quit