0
                do
                {
                  Console.Write("     <jaar 1582 - 2500>...");
                } while(!int.TryParse(Console.ReadLine(), out jaar) && jaar < 1582);

Why doesn't this work in C#?
you can't test a integeren in a do while when there's a tryparse apperently
whats the best way of doing this?

Thank you for your time.

2
Contributors
2
Replies
10
Views
2 Years
Discussion Span
Last Post by Tigr@
0

Why doesn't this work in C#?

Because you should be using || in your loop rather than &&. With &&, jaar will only be compared to 1582 if TryParse fails, which is somewhat nonsensical.

0

Thank you for clearing this up.
And I now see the flaws in my logic. I should've known this.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.