Bird
0
0

Why does the for loop in PowerShell require the condition to use operators like -lt instead of symbols like <?

hard📝 Conceptual Q10 of 15
PowerShell - Control Flow

Why does the for loop in PowerShell require the condition to use operators like -lt instead of symbols like <?

ABecause <code>-lt</code> is faster than <code><</code>
BBecause symbols like <code><</code> cause syntax errors in all programming languages
CBecause PowerShell uses its own comparison operators for clarity and consistency
DBecause <code><</code> is only for HTML, not code
Step-by-Step Solution
Solution:
  1. Step 1: Understand PowerShell operator design

    PowerShell uses named operators like '-lt' for readability and to avoid conflicts.
  2. Step 2: Evaluate other options

    Symbols like '<' are valid in many languages but PowerShell prefers named operators; syntax errors depend on context; speed difference is negligible; '<' is not only for HTML.
  3. Final Answer:

    Because PowerShell uses its own comparison operators for clarity and consistency -> Option C
  4. Quick Check:

    PowerShell uses named operators like '-lt' [OK]
Quick Trick: PowerShell uses named operators like '-lt' for clarity [OK]
Common Mistakes:
  • Thinking '<' always causes errors
  • Believing '-lt' is faster
  • Confusing HTML symbols with code operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes