Instance Method

advanced(by:)

Returns a new value advanced by the given distance.

Declaration

func advanced(by amount: Float80) -> Float80

Parameters

amount

The distance to advance this value.

Return Value

A new value that is amount added to this value.

Discussion

For two values x and d, the result of a x.advanced(by: d) is equal to x + d—a new value y such that x.distance(to: y) approximates d. For example:

let x = 21.5
let y = x.advanced(by: -6.5)
// y == 15.0

print(x.distance(to: y))
// Prints "-6.5"

Relationships

From Protocol