incrementWrap

fun incrementWrap(n: Int? = definedExternally, maximumValue: Double? = definedExternally, minimumValue: Double? = definedExternally): Double(source)

Increments a number with a wrapping to a minimum value if the number exceeds the maximum value.

const n = Math.incrementWrap(5, 10, 0); // returns 6
const m = Math.incrementWrap(10, 10, 0); // returns 0

Return

The incremented number.

Parameters

n

The number to be incremented.

maximumValue

The maximum incremented value before rolling over to the minimum value.

minimumValue

The number reset to after the maximum value has been exceeded. Default value - 0.0

See also