Fix validation in Lesson 2 Task 2
This commit is contained in:
parent
0c9ebe46aa
commit
6548c0b5f0
1 changed files with 2 additions and 2 deletions
|
@ -21,14 +21,14 @@ int maximum;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Console.Write("Enter minimum age: ");
|
Console.Write("Enter minimum age: ");
|
||||||
if (int.TryParse(Console.ReadLine(), out minimum) || minimum >= 0 || minimum <= 130)
|
if (int.TryParse(Console.ReadLine(), out minimum) && minimum >= 0 && minimum <= 130)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Console.Write("Enter maximum age: ");
|
Console.Write("Enter maximum age: ");
|
||||||
if (int.TryParse(Console.ReadLine(), out maximum) || maximum >= minimum || maximum <= 130)
|
if (int.TryParse(Console.ReadLine(), out maximum) && maximum >= minimum && maximum <= 130)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue