Complete the code to create a range of numbers from 1 to 5.
$numbers = 1 [1] 5 $numbers
The range operator in PowerShell is ... It creates a sequence of numbers from the start to the end.
Complete the code to create a descending range from 5 down to 1.
$numbers = 5 [1] 1 $numbers
The range operator .. works for descending sequences too, from higher to lower numbers.
Fix the error in the code to generate numbers from 1 to 10.
$nums = 1 [1] 10 $nums
The correct range operator is ... Using a dash (-) causes an error because it means subtraction.
Fill both blanks to create a range from 3 to 7 and then select numbers greater than 4.
$range = [1] [2] 7 $filtered = $range | Where-Object { $_ -gt 4 } $filtered
To create a range from 3 to 7, use 3 .. 7. The operator is ...
Fill all three blanks to create a range from 2 to 6 and filter numbers less than 5.
$nums = [1] [2] 6 $filtered = $nums | Where-Object { $_ [3] 5 } $filtered
Use 2 .. 6 to create the range. To filter numbers less than 5, use -lt in the condition.