Answer by Stephen Ross for Continue loop between classes after wrong input
When you are attempting to retrieve the second value continue to loop until the value you retrieve is valid for your case. private int GetUserValue(int index) { var secondValueValid = false; int...
View ArticleAnswer by Peter Duniho for Continue loop between classes after wrong input
There are many possible ways to accomplish your goal. But it seems to me one of the most obvious is to follow the example set by int.TryParse(), which you are already using. Change your...
View ArticleAnswer by Steve for Continue loop between classes after wrong input
You could use the same pattern used by Int32.TryParse. Meaning you pass the number to be added as an out parameter and return a boolean false if the number is not valid public static bool...
View ArticleContinue loop between classes after wrong input
I'm trying to make a class that is going to sum a number of whole numbers that is collected from the console window. The class first asks for how many numbers to sum and then reads that many integers...
View Article