PowerShell - OperatorsWhich of the following is the correct syntax to check if variable $num is less than or equal to 100 in PowerShell?Aif ($num -le 100) {}Bif ($num <= 100) {}Cif ($num -lt= 100) {}Dif ($num =< 100) {}Check Answer
Step-by-Step SolutionSolution:Step 1: Recall PowerShell comparison operatorsPowerShell uses '-le' for 'less than or equal to', not '<='.Step 2: Identify correct syntax'if ($num -le 100) {}' is valid; others are invalid syntax.Final Answer:if ($num -le 100) {} -> Option AQuick Check:'-le' means less or equal [OK]Quick Trick: Use '-le' for less than or equal in PowerShell [OK]Common Mistakes:Using '<=' instead of '-le'Writing '-lt=' or '=<' which are invalidConfusing assignment '=' with comparison
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