protocol
AbsoluteValuable
Inheritance |
Comparable, Equatable, ExpressibleByIntegerLiteral, SignedNumber
View Protocol Hierarchy →
|
---|---|
Associated Types |
A type that represents an integer literal. The standard library integer and floating-point types are all valid types
for 1 inherited item hidden. (Show all) |
Import |
|
Initializers
Creates an instance initialized to the specified integer value.
Do not call this initializer directly. Instead, initialize a variable or constant using an integer literal. For example:
let
x
=
23
In this example, the assignment to the x
constant calls this integer
literal initializer behind the scenes.
value
: The value to create.
Declaration
init
(
integerLiteral
value
:
Self
.
IntegerLiteralType
)
Declared In
ExpressibleByIntegerLiteral
1 inherited item hidden. (Show all)
Static Methods
Returns the absolute value of x
.
Declaration
static
func
abs
(
_
x
:
Self
) -
>
Self
Instance Methods
Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
This function is the only requirement of the Comparable
protocol. The
remainder of the relational operator functions are implemented by the
standard library for any type that conforms to Comparable
.
Parameters: lhs: A value to compare. rhs: Another value to compare.
Declaration
func
<
(
lhs
:
Self
,
rhs
:
Self
) -
>
Bool
Declared In
Comparable
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
Parameters: lhs: A value to compare. rhs: Another value to compare.
Declaration
func
<
=(
lhs
:
Self
,
rhs
:
Self
) -
>
Bool
Declared In
Comparable
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values a
and b
,
a == b
implies that a != b
is false
.
Parameters: lhs: A value to compare. rhs: Another value to compare.
Declaration
func
==(
lhs
:
Self
,
rhs
:
Self
) -
>
Bool
Declared In
Equatable
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
Parameters: lhs: A value to compare. rhs: Another value to compare.
Declaration
func
>
(
lhs
:
Self
,
rhs
:
Self
) -
>
Bool
Declared In
Comparable
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
Parameters: lhs: A value to compare. rhs: Another value to compare.
Declaration
func
>
=(
lhs
:
Self
,
rhs
:
Self
) -
>
Bool
Declared In
Comparable
Returns the result of negating x
.
Declaration
prefix
func
-(
x
:
Self
) -
>
Self
Declared In
SignedNumber
Returns the difference between lhs
and rhs
.
Declaration
func
-(
lhs
:
Self
,
rhs
:
Self
) -
>
Self
Declared In
SignedNumber
7 inherited items hidden. (Show all)
Default Implementations
Create an instance initialized to value
.
Declaration
init
(
integerLiteral
value
:
Self
)
Declared In
ExpressibleByIntegerLiteral
1 inherited item hidden. (Show all)
A type that supports an "absolute value" function.