# method Int

Documentation for method Int, assembled from the following types:

# class List

From List

## (List) method Int

Defined as:

method Int(List: --> Int)

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: --> Int)

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 Str

From Str

## (Str) method Int

Defined as:

method Int(Str: --> Int)

Coerces the string to Int, using the same rules as `Str.Numeric`

.

# role Rational

From Rational

## (Rational) method Int

Defined as:

method Int(Rational: --> Int)

Coerces the invocant to Int by truncating non-whole portion of the represented number, if any. If the denominator is zero, will fail with `X::Numeric::DivideByZero`

.

# class Map

From Map

## (Map) method Int

Defined as:

method Int(Map: --> Int)

Returns the number of pairs stored in the `Map`

(same as `.elems`

).

my = Map.new('a' => 2, 'b' => 17);say .Int; # OUTPUT: «2»

# class IO::Path

From IO::Path

## (IO::Path) method Int

Defined as:

method Int(IO::Path: --> Int)

Coerces `.basename`

to Int. Fails with `X::Str::Numeric`

if base name is not numerical.

# class IntStr

From IntStr

## (IntStr) method Int

method Int

Returns the integer value of the `IntStr`

.