Operator: +

operator + { associativity left precedence }

Declarations

func +(_: Double, rhs: Double)

Adds two values and produces their sum, rounded to a representable value.

The addition operator (+) calculates the sum of its two arguments. For example:

let x = 1.5
let y = x + 2.25
// y == 3.75

The + operator implements the addition operation defined by the IEEE 754 specification.

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Double, rhs: Double) -> Double
func +(_: Float, rhs: Float)

Adds two values and produces their sum, rounded to a representable value.

The addition operator (+) calculates the sum of its two arguments. For example:

let x = 1.5
let y = x + 2.25
// y == 3.75

The + operator implements the addition operation defined by the IEEE 754 specification.

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Float, rhs: Float) -> Float
func +(_: Float80, rhs: Float80)

Adds two values and produces their sum, rounded to a representable value.

The addition operator (+) calculates the sum of its two arguments. For example:

let x = 1.5
let y = x + 2.25
// y == 3.75

The + operator implements the addition operation defined by the IEEE 754 specification.

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Float80, rhs: Float80) -> Float80
func +(_: Int, rhs: Int)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Int, rhs: Int) -> Int
func +(_: Int8, rhs: Int8)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Int8, rhs: Int8) -> Int8
func +(_: Int16, rhs: Int16)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Int16, rhs: Int16) -> Int16
func +(_: Int32, rhs: Int32)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Int32, rhs: Int32) -> Int32
func +(_: Int64, rhs: Int64)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Int64, rhs: Int64) -> Int64
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum, rounded to a representable value.

The addition operator (+) calculates the sum of its two arguments. For example:

let x = 1.5
let y = x + 2.25
// y == 3.75

The + operator implements the addition operation defined by the IEEE 754 specification.

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

BinaryFloatingPoint, Strideable
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

Strideable
func +(_: Self, rhs: Self.Stride)

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

Strideable
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

Strideable
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

Strideable
func +(_: Self, rhs: Self.Stride)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

FixedWidthInteger
func +(_: Self, rhs: Self.Stride)

Declaration

func +(lhs: Self, rhs: Self.Stride) -> Self

Declared In

Strideable
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

Strideable
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

Strideable
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum, rounded to a representable value.

The addition operator (+) calculates the sum of its two arguments. For example:

let x = 1.5
let y = x + 2.25
// y == 3.75

The + operator implements the addition operation defined by the IEEE 754 specification.

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

BinaryFloatingPoint, Strideable
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

Strideable
func +(_: Self.Stride, rhs: Self)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

FixedWidthInteger
func +(_: Self.Stride, rhs: Self)

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

Strideable
func +(_: Self.Stride, rhs: Self)

Declaration

func +(lhs: Self.Stride, rhs: Self) -> Self

Declared In

Strideable
func +(_: String, rhs: String)

Declaration

func +(lhs: String, rhs: String) -> String
func +(_: UInt, rhs: UInt)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: UInt, rhs: UInt) -> UInt
func +(_: UInt8, rhs: UInt8)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: UInt8, rhs: UInt8) -> UInt8
func +(_: UInt16, rhs: UInt16)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: UInt16, rhs: UInt16) -> UInt16
func +(_: UInt32, rhs: UInt32)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: UInt32, rhs: UInt32) -> UInt32
func +(_: UInt64, rhs: UInt64)

Adds two values and produces their sum.

The addition operator (+) calculates the sum of its two arguments. For example:

1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75

You cannot use + with arguments of different types. To add values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021

The sum of the two arguments must be representable in the arguments' type. In the following example, the result of 21 + 120 is greater than the maximum representable Int8 value:

x + 120                 // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow addition operator (&+).

x &+ 120                // -115

Parameters: lhs: The first value to add. rhs: The second value to add.

Declaration

func +(lhs: UInt64, rhs: UInt64) -> UInt64
func + <Other>(_: Other, rhs: Self)

Creates a new collection by concatenating the elements of a sequence and a collection.

The two arguments must have the same Element type. For example, you can concatenate the elements of a Range<Int> instance and an integer array.

let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of argument on the right-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A collection or finite sequence. rhs: A range-replaceable collection.

Declaration

func +<Other>(lhs: Other, rhs: Self) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Other, rhs: Self)

Creates a new collection by concatenating the elements of a sequence and a collection.

The two arguments must have the same Element type. For example, you can concatenate the elements of a Range<Int> instance and an integer array.

let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of argument on the right-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A collection or finite sequence. rhs: A range-replaceable collection.

Declaration

func +<Other>(lhs: Other, rhs: Self) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Other, rhs: Self)

Creates a new collection by concatenating the elements of a sequence and a collection.

The two arguments must have the same Element type. For example, you can concatenate the elements of a Range<Int> instance and an integer array.

let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of argument on the right-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A collection or finite sequence. rhs: A range-replaceable collection.

Declaration

func +<Other>(lhs: Other, rhs: Self) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Other, rhs: Self)

Creates a new collection by concatenating the elements of a sequence and a collection.

The two arguments must have the same Element type. For example, you can concatenate the elements of a Range<Int> instance and an integer array.

let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of argument on the right-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A collection or finite sequence. rhs: A range-replaceable collection.

Declaration

func +<Other>(lhs: Other, rhs: Self) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Other, rhs: Self)

Creates a new collection by concatenating the elements of a sequence and a collection.

The two arguments must have the same Element type. For example, you can concatenate the elements of a Range<Int> instance and an integer array.

let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of argument on the right-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A collection or finite sequence. rhs: A range-replaceable collection.

Declaration

func +<Other>(lhs: Other, rhs: Self) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Other, rhs: Self)

Creates a new collection by concatenating the elements of a sequence and a collection.

The two arguments must have the same Element type. For example, you can concatenate the elements of a Range<Int> instance and an integer array.

let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of argument on the right-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A collection or finite sequence. rhs: A range-replaceable collection.

Declaration

func +<Other>(lhs: Other, rhs: Self) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Other, rhs: Self)

Creates a new collection by concatenating the elements of a sequence and a collection.

The two arguments must have the same Element type. For example, you can concatenate the elements of a Range<Int> instance and an integer array.

let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of argument on the right-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A collection or finite sequence. rhs: A range-replaceable collection.

Declaration

func +<Other>(lhs: Other, rhs: Self) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Self, rhs: Other)

Creates a new collection by concatenating the elements of two collections.

The two arguments must have the same Element type. For example, you can concatenate the elements of two integer arrays.

let lowerNumbers = [1, 2, 3, 4]
let higherNumbers: ContiguousArray = [5, 6, 7, 8, 9, 10]
let allNumbers = lowerNumbers + higherNumbers
print(allNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of the argument on the left-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A range-replaceable collection. rhs: Another range-replaceable collection.

Declaration

func +<Other>(lhs: Self, rhs: Other) -> Self where Other : RangeReplaceableCollection, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Self, rhs: Other)

Creates a new collection by concatenating the elements of two collections.

The two arguments must have the same Element type. For example, you can concatenate the elements of two integer arrays.

let lowerNumbers = [1, 2, 3, 4]
let higherNumbers: ContiguousArray = [5, 6, 7, 8, 9, 10]
let allNumbers = lowerNumbers + higherNumbers
print(allNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of the argument on the left-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A range-replaceable collection. rhs: Another range-replaceable collection.

Declaration

func +<Other>(lhs: Self, rhs: Other) -> Self where Other : RangeReplaceableCollection, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Self, rhs: Other)

Creates a new collection by concatenating the elements of two collections.

The two arguments must have the same Element type. For example, you can concatenate the elements of two integer arrays.

let lowerNumbers = [1, 2, 3, 4]
let higherNumbers: ContiguousArray = [5, 6, 7, 8, 9, 10]
let allNumbers = lowerNumbers + higherNumbers
print(allNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of the argument on the left-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A range-replaceable collection. rhs: Another range-replaceable collection.

Declaration

func +<Other>(lhs: Self, rhs: Other) -> Self where Other : RangeReplaceableCollection, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Self, rhs: Other)

Creates a new collection by concatenating the elements of two collections.

The two arguments must have the same Element type. For example, you can concatenate the elements of two integer arrays.

let lowerNumbers = [1, 2, 3, 4]
let higherNumbers: ContiguousArray = [5, 6, 7, 8, 9, 10]
let allNumbers = lowerNumbers + higherNumbers
print(allNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of the argument on the left-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A range-replaceable collection. rhs: Another range-replaceable collection.

Declaration

func +<Other>(lhs: Self, rhs: Other) -> Self where Other : RangeReplaceableCollection, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Self, rhs: Other)

Creates a new collection by concatenating the elements of a collection and a sequence.

The two arguments must have the same Element type. For example, you can concatenate the elements of an integer array and a Range<Int> instance.

let numbers = [1, 2, 3, 4]
let moreNumbers = numbers + 5...10
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of the argument on the left-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A range-replaceable collection. rhs: A collection or finite sequence.

Declaration

func +<Other>(lhs: Self, rhs: Other) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Self, rhs: Other)

Creates a new collection by concatenating the elements of a collection and a sequence.

The two arguments must have the same Element type. For example, you can concatenate the elements of an integer array and a Range<Int> instance.

let numbers = [1, 2, 3, 4]
let moreNumbers = numbers + 5...10
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of the argument on the left-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A range-replaceable collection. rhs: A collection or finite sequence.

Declaration

func +<Other>(lhs: Self, rhs: Other) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection
func + <Other>(_: Self, rhs: Other)

Creates a new collection by concatenating the elements of a collection and a sequence.

The two arguments must have the same Element type. For example, you can concatenate the elements of an integer array and a Range<Int> instance.

let numbers = [1, 2, 3, 4]
let moreNumbers = numbers + 5...10
print(moreNumbers)
// Prints "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

The resulting collection has the type of the argument on the left-hand side. In the example above, moreNumbers has the same type as numbers, which is [Int].

Parameters: lhs: A range-replaceable collection. rhs: A collection or finite sequence.

Declaration

func +<Other>(lhs: Self, rhs: Other) -> Self where Other : Sequence, Self.Element == Other.Element

Declared In

RangeReplaceableCollection