Bird
0
0

What does the Swift range operator 1...5 represent?

easy📝 Conceptual Q11 of 15
Swift - Operators and Expressions
What does the Swift range operator 1...5 represent?
AA range including numbers 1, 2, 3, 4, and 5
BA range including numbers 1, 2, 3, and 4 only
CA range excluding number 1 but including 5
DA range excluding both 1 and 5
Step-by-Step Solution
Solution:
  1. Step 1: Understand the closed range operator

    The ... operator creates a range that includes both the start and end values.
  2. Step 2: Apply to the given range

    For 1...5, it includes 1, 2, 3, 4, and 5.
  3. Final Answer:

    A range including numbers 1, 2, 3, 4, and 5 -> Option A
  4. Quick Check:

    1...5 includes 5 [OK]
Quick Trick: Remember: ... includes end number, ..< excludes it [OK]
Common Mistakes:
  • Thinking ... excludes the last number
  • Confusing ... with ..<
  • Assuming ..< includes the end number

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes