In Cool§

See primary documentation in context for method UInt

multi method UInt()

Coerces the invocant to an Int. Fails if the coercion to an Int cannot be done or if the Int the invocant had been coerced to is negative.

say 1+0i.UInt;            # OUTPUT: «1␤» 
say 2e1.UInt;             # OUTPUT: «20␤» 
say 1.3.UInt;             # OUTPUT: «1␤» 
say (-4/3).UInt.^name;    # OUTPUT: «Failure␤» 
say "foo".UInt.^name;     # OUTPUT: «Failure␤»