Skip to main content

wrapi

Function wrapi 

pub fn wrapi(value: i64, min: i64, max: i64) -> i64
Expand description

Wraps the integer value between min and max. min is inclusive while max is exclusive. This can be used for creating loop-like behavior or infinite surfaces.

# Infinite loop between 5 and 9
frame = wrapi(frame + 1, 5, 10)
# result is -2
var result = wrapi(-6, -5, -1)