PowerShell - OperatorsIdentify the error in this PowerShell code:$nums = 1..5..1AIt creates a range from 1 to 5 with step 1 correctlyBIt creates an array with one element: 1..5..1CRange operator cannot have two dots twice; syntax errorDIt creates a range from 1 to 1Check Answer
Step-by-Step SolutionSolution:Step 1: Analyze the syntax of the range operatorThe range operator uses exactly two dots .. between two numbers.Step 2: Identify the error in 1..5..1Using two sets of dots is invalid syntax and causes an error.Final Answer:Range operator cannot have two dots twice; syntax error -> Option CQuick Check:Range operator syntax = number..number only [OK]Quick Trick: Range operator uses exactly two dots, no more [OK]Common Mistakes:Trying to specify step size with extra dotsConfusing range operator with other languages' syntaxExpecting it to create a stepped range
Master "Operators" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Control Flow - Why control flow directs execution - Quiz 2easy Control Flow - Why control flow directs execution - Quiz 13medium Operators - Assignment operators - Quiz 2easy Operators - Ternary operator (PowerShell 7+) - Quiz 12easy Operators - Ternary operator (PowerShell 7+) - Quiz 11easy Operators - Why operators perform comparisons and logic - Quiz 15hard Operators - Ternary operator (PowerShell 7+) - Quiz 6medium String Operations - Why string manipulation is frequent - Quiz 3easy Variables and Data Types - Automatic variables ($_, $PSVersionTable) - Quiz 4medium Variables and Data Types - Automatic variables ($_, $PSVersionTable) - Quiz 11easy