SplitScript reference / Duration / lessThanOrEqual

Duration.lessThanOrEqual

Operator

Duration.lessThanOrEqual(other: Duration) -> bool

Reports whether this duration is no longer than another duration.

This method implements the <= operator without converting to floating point.

Parameters

  • other: The duration to compare against.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Accept a duration at an inclusive limit

let elapsed = Duration.fromMilliseconds(250.0)
let limit = Duration.fromMilliseconds(250.0)
let accepted = elapsed <= limit