C#C
C#2y ago
Mix

Help with why code is returning this way.

Hello, I'm a CS student learning C# for the first time and i'm having some confusion on why my code is returning the way it is. If I input a number and it's a valid number in the array, the program will say it's wrong multiple times before finally printing all of the right data. When I put a break on the end of the else statement, it just says "Sorry, no data for 2020." and then just ends. But if I remove the break , it says its wrong multiple times before finally printing the expected result. If anyone has any insight into why this is happening, I'd really appreciate it!
image.png
Was this page helpful?