round
Rounds the measure to the closest integer, retaining its units.
Returns a Measure that is rounded to he closest multiple of toNearest, and has the the units of toNearest.
val length = 25 * inches
round(length, toNearest = 1 * feet ) // 2.0 feet
round(length, toNearest = 0.1 * meters) // 0.6 m
Content copied to clipboard