operator
..
<
{
associativity
precedence
}
Declarations
Returns a countable half-open range that contains its lower bound but not its upper bound.
Use the half-open range operator (..<
) to create a range of any type that
conforms to the Strideable
protocol with an associated integer Stride
type, such as any of the standard library's integer types. This example
creates a CountableRange<Int>
from zero up to, but not including, 5.
let
upToFive
=
0
..
<
5
(
upToFive
.
contains
(
3
))
// Prints "true"
(
upToFive
.
contains
(
5
))
// Prints "false"
You can use sequence or collection methods on the upToFive
countable
range.
(
upToFive
.
count
)
// Prints "5"
(
upToFive
.
last
)
// Prints "4"
Parameters: minimum: The lower bound for the range. maximum: The upper bound for the range.
Declaration
func
..
<
<
Bound
where
Bound
:
_Strideable
&
Comparable
,
Bound
.
Stride
:
Integer
>
(
minimum
:
Bound
,
maximum
:
Bound
) -
>
CountableRange
<
Bound
>
Returns a half-open range that contains its lower bound but not its upper bound.
Use the half-open range operator (
..<
) to create a range of any type that conforms to theComparable
protocol. This example creates aRange<Double>
from zero up to, but not including, 5.0.Parameters: minimum: The lower bound for the range. maximum: The upper bound for the range.
Declaration
func
..
<
<
Bound
:
Comparable
>
(
minimum
:
Bound
,
maximum
:
Bound
) -
>
Range
<
Bound
>