Bird
0
0

What does the Swift range operator .. represent?

easy📝 Conceptual Q1 of 15
Swift - Operators and Expressions
What does the Swift range operator ..< represent?
AA range that includes the end value but excludes the start value
BA range that includes both start and end values
CA range that excludes both start and end values
DA range that includes the start value but excludes the end value
Step-by-Step Solution
Solution:
  1. Step 1: Understand the half-open range operator

    The ..< operator creates a range that starts at the first value and goes up to but does not include the second value.
  2. Step 2: Compare with closed range operator

    The closed range operator ... includes both start and end values, unlike ..<.
  3. Final Answer:

    A range that includes the start value but excludes the end value -> Option D
  4. Quick Check:

    Half-open range = includes start, excludes end [OK]
Quick Trick: ..< excludes the end value, ... includes it [OK]
Common Mistakes:
  • Confusing ... and ..<
  • Thinking ..< includes the end
  • Mixing up start and end inclusion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes