_methods
trait _methods
Int Extension Methods
Extension methods universaly avaialble for type scala.Int
- Source
- _methods.scala
Def
@targetName("range")
Range
Range
Returns Int.Range from current to given value
(1 <> 10).tp // Prints 1 <> 10
- Source
- _methods.scala
@targetName("rangeOfSize")
Range by size
Range by size
Returns Int.Range starting at current value and with given size
(5 <>= 10).tp // Prints 5 <> 14
- Source
- _methods.scala
@targetName("rangeX")
Exclusive end range
Exclusive end range
Returns Int.Range from current to given value exclusive
(1 <>> 10).tp // Prints 1 <> 9
- Source
- _methods.scala
@targetName("Opt")
To option
To option
Returns Int.Opt for current value
val o : Int.Opt = 12.?
- Source
- _methods.scala
Max value
Max value
Returns maximum of current or given value
val b = 5
b.max(0).tp // Prints 5
b.max(10).tp // Prints 10
- Source
- _methods.scala
Min value
Min value
Returns minimun of current or given value
val b = 5
b.min(0).tp // Prints 0
b.min(10).tp // Prints 5
- Source
- _methods.scala
Round to size
Round to size
Rounds current value to specified size
91.roundTo(5).tp // Prints 90
91.roundTo(5)(using UP).tp // Prints 95
- Source
- _methods.scala