Forcing user to choose 1, 2 or 3
Hello, im a bit lost! first is a while-loop to make sure input is not null, but then how would I best structure this to make it not move on if input is not 1, 2 or 3? Switch didnt work, since default; sends user back to the menu instead of changing the input
11 Replies
is there any way to make this a part of the while loop?
so that it will enter loop not only if TryParse but also if number is not one two or three?
&& (bokTyp < 1 || bokTyp > 3)
did i put it incorrectly? it moves on to the switch anyways
Ah, it's
|| !(bokTyp >= 1 && bokTyp <= 3)
Other way aroundStill not working, not getting any error messages but it doesnt seem to be checking the second condition before moving on from the while
While(boktype <= 3 && boktype >=1)
This should work
(!value.IsNullOrEmpty(input))
You can use this to check for null or empty
I was missing one set of ()! now it does check the second condition but instead, doesnt move on despite the number being 1 2 3 :p
Ero#1111
REPL Result: Success
Console Output
Compile: 574.279ms | Execution: 82.951ms | React with ❌ to remove this embed.
Thank you so much!!
success