PowerShell - OperatorsWhich of the following is the correct syntax to check if variable $a is greater than 10 in PowerShell?Aif ($a > 10) { }Bif ($a -gt 10) { }Cif ($a gt 10) { }Dif ($a => 10) { }Check Answer
Step-by-Step SolutionSolution:Step 1: Recall PowerShell comparison syntaxPowerShell uses operators with a dash, like -gt for greater than, not symbols like > or =>.Step 2: Identify the correct operator for greater thanThe correct operator is -gt, so the syntax is if ($a -gt 10) { }.Final Answer:if ($a -gt 10) { } -> Option BQuick Check:Greater than operator = -gt [OK]Quick Trick: Use dash before comparison operators in PowerShell [OK]Common Mistakes:Using > instead of -gtWriting 'gt' without dashUsing invalid operator =>
Master "Operators" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Cmdlets and Pipeline - ForEach-Object for iteration - Quiz 8hard Control Flow - If-elseif-else statements - Quiz 13medium Control Flow - ForEach loop - Quiz 13medium Control Flow - For loop - Quiz 7medium PowerShell Basics and Environment - Command discovery (Get-Command) - Quiz 11easy PowerShell Basics and Environment - Command discovery (Get-Command) - Quiz 4medium String Operations - Here-strings for multiline - Quiz 8hard String Operations - String interpolation (double quotes) - Quiz 8hard String Operations - Why string manipulation is frequent - Quiz 2easy Variables and Data Types - Integer and floating-point types - Quiz 13medium