
It looks like you're new here. If you want to get involved, click one of these buttons!
Hi, I just started learning C# (total noob here) and I´m trying to do some experimentation with challenge 5 of the newest C# videos.
I solved the challenge, but i wan't the program to loop a "Wrong answer" line everytime the user types any other number than 4 (which is the lenght i've set for the array)
I managed to loop the "Wrong answer" line, but i can't figure out how to exit the loop and return to the challenge after the user types the right number (4) .
Here´s what i've done so far:
I´m stuck at the last while loop
Thanks for reading, hope you can help me and understand what i tried to say, my english sucks 😅
Answers
Since you set the value of newCount before the loop, when you enter the loop you compare it to the old value, but never assign it to the new value the user entered.
Inside the loop you need to write:
newCount = Convert.ToInt32(Console.ReadLine());
This updates the newCount with the latest input from the user