Number
type Integer
Implements Monoid, Group, Blankable, Truthyable.
even?
even? : Bool
Returns true if the integer is even.
Examples
4.even? # => true
3.even? # => false
modulo
modulo(n: Integer) -> Integer
Returns this modulo n. The result has the same sign as n, consistent with mathematical modulo (not C remainder).
Parameters
n
Examples
7.modulo(3) # => 1
(-7).modulo(3) # => 2
in?
in?(range: Range<Integer>) -> Bool
Returns true if the integer falls within range (inclusive).
Parameters
range
Examples
5.in?(1..10) # => true
11.in?(1..10) # => false
From Monoid
repeat- Combines this value with itself
ntimes.
Defined in other modules
type Float
Implements Blankable, Truthyable.
Defined in other modules
module Integer
parse
parse(s: String) -> Result<Integer, ParseError>
parse(s: String, radix: Integer) -> Result<Integer, ParseError>
Parses s in base radix (2..36), e.g. Integer.parse("ff", radix: 16). Digits above 9 are accepted in either case.
parsePrefix
parsePrefix(s: String) -> (Integer, String)?
module Float
parse
parse(s: String) -> Result<Float, ParseError>
parsePrefix
parsePrefix(s: String) -> (Float, String)?
module Number
parse
parse(s: String) -> Result<Number, ParseError>