Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

специальный тип, позволяющий создавать

упорядоченные множества
is
последовательных значений
property hashValue Hashable can be endless or not

== Equatable classification
1..<N (1=1, N=N-1)
all the ranges are not comparable as we can't binary (operator between operands)
Comparable
compare them with <, >, <=, >=.
type Range<Type> Type should be Comparable
half-open range ..< two forms
..<N (first element is nil, N=N-1)
prefix/ one-sided range (operator before
count
operand)
type PartialRangeUpTo<Type> Type should be Comparable
isEmpty
2 types of operators 1...N (1=1, N=N)
value of the first element binary(closed range operator)
propeties
only for Int
lowerBound
Ranges type ClosedRange<Type> Type should be Comparable

1... (1=1, second element=nil)


value of the second element closed range ... three forms postfix (one-sided range)
upperBound type PartialRangeFrom<Type> Type should be Comparable
only for Int
...N(first element=nil, N=N)
prefix (one-sided range)
contains(_:) type PartialRangeThrough<Type> Type should be Comparable

minimal value
min() empty range let emptyR = 0..<0
only for Int
methods
range with one element let notEmptyR = 0...0
maximum value
max() PartialRangeThrough<Type>
!!! not Sequence and not Collection ->
only for Int
Strideable
PartialRangeUpTo<Type>

Sequence, not Collection as this range is


PartialRangeFrom<Type>
endless

You might also like