Update Lesson 2 Task 2
This commit is contained in:
parent
722437f3f7
commit
a60bfaf1cd
1 changed files with 22 additions and 19 deletions
|
@ -16,16 +16,19 @@ List<Person> people = new List<Person>()
|
|||
int minimum;
|
||||
int maximum;
|
||||
|
||||
do
|
||||
while (true)
|
||||
{
|
||||
Console.Write("Enter minimum age: ");
|
||||
} while (!int.TryParse(Console.ReadLine(), out minimum) || minimum < 0 || minimum > 130);
|
||||
Console.Write($"Enter minimum age: ");
|
||||
if (int.TryParse(Console.ReadLine(), out minimum) || minimum >= 0 || minimum <= 130)
|
||||
break;
|
||||
}
|
||||
|
||||
do
|
||||
while (true)
|
||||
{
|
||||
Console.Write("Enter maximum age: ");
|
||||
userInput = Console.ReadLine();
|
||||
} while (!int.TryParse(Console.ReadLine(), out maximum) || maximum < minimum || maximum > 130);
|
||||
Console.Write($"Enter maximum age: ");
|
||||
if (int.TryParse(Console.ReadLine(), out maximum) || maximum >= minimum || maximum <= 130)
|
||||
break;
|
||||
}
|
||||
|
||||
var selected = from person in people where person.Age >= minimum && person.Age <= maximum select person;
|
||||
|
||||
|
|
Reference in a new issue