PowerShell - OperatorsWhich of the following is the correct syntax to check if variable $a is greater than 10 in PowerShell?Aif ($a -gt 10) { }Bif ($a > 10) { }Cif ($a -lt 10) { }Dif ($a -eq 10) { }Check Answer
Step-by-Step SolutionSolution:Step 1: Recall PowerShell comparison syntaxPowerShell uses -gt for greater than, not > like some other languages.Step 2: Match the correct operatorThe correct syntax to check if $a is greater than 10 is if ($a -gt 10) { }.Final Answer:if ($a -gt 10) { } -> Option AQuick Check:Greater than operator = -gt [OK]Quick Trick: Use -gt for greater than, not > in PowerShell [OK]Common Mistakes:Using > instead of -gtConfusing -lt with -gtMissing parentheses in if statement
Master "Operators" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Cmdlets and Pipeline - Pipeline object flow - Quiz 5medium Cmdlets and Pipeline - Where-Object for filtering - Quiz 14medium Cmdlets and Pipeline - Why cmdlets are the building blocks - Quiz 8hard Control Flow - Switch statement - Quiz 11easy Control Flow - Why control flow directs execution - Quiz 6medium Control Flow - Switch with wildcard and regex - Quiz 7medium Operators - Logical operators (-and, -or, -not) - Quiz 4medium String Operations - Here-strings for multiline - Quiz 14medium String Operations - Regular expressions with -match - Quiz 4medium Variables and Data Types - Hash tables (dictionaries) - Quiz 2easy