Bird
0
0

Why does PowerShell require the colon ':' in the ternary operator syntax?

hard📝 Conceptual Q10 of 15
PowerShell - Operators
Why does PowerShell require the colon ':' in the ternary operator syntax?
ATo separate multiple conditions
BTo mark the end of the condition
CTo separate the true-value from the false-value
DTo indicate the start of the condition
Step-by-Step Solution
Solution:
  1. Step 1: Understand ternary operator parts

    The ternary operator has three parts: condition, true-value, and false-value.
  2. Step 2: Role of colon ':'

    The colon ':' separates the true-value from the false-value, clarifying which value to return if the condition is false.
  3. Final Answer:

    To separate the true-value from the false-value -> Option C
  4. Quick Check:

    Colon separates true and false values [OK]
Quick Trick: Colon divides true and false parts in ternary [OK]
Common Mistakes:
  • Thinking colon ends the condition
  • Assuming colon separates multiple conditions
  • Confusing colon with question mark

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes