Documentation for routine Int

Documentation for routine Int, assembled from the following types:

class List

From List

(List) method Int

Defined as:

method Int(List:D: --> Int:D)

Returns the number of elements in the list (same as .elems).

say (1,2,3,4,5).Int# OUTPUT: «5␤» 

role Numeric

From Numeric

(Numeric) method Int

method Int(Numeric:D: --> Int:D)

If this Numeric is equivalent to a Real, return the equivalent of calling truncate on that Real to get an Int. Fail with X::Numeric::Real otherwise.

class Map

From Map

(Map) method Int

Defined as:

method Int(Map:D: --> Int:D)

Returns the number of pairs stored in the Map (same as .elems).

my $m ='a' => 2'b' => 17);
say $m.Int;                                       # OUTPUT: «2␤» 

class IntStr

From IntStr

(IntStr) method Int

method Int

Returns the integer value of the IntStr.