package RakuAST::RatLiteral

Represent a literal rational number
class RakuAST::RatLiteral { }

The RakuAST::RatLiteral class represents a rational number (such as `42.666`).

Object introspection

RakuAST::RatLiteral objects are typically created when parsing Raku Programming Language code. So most developers will only need to know how to introspect the objects created.

These introspection methods are available (in alphabetical order):

value

say $literal.value;

The value method returns the value it is representing.

Object creation

There is one way to create a RakuAST::RatLiteral object directly (rather than having RakuAST::Literal.from-value figure it out):

new

my $literal = RakuAST::RatLiteral.new(42.666);
say $literal.^name;  # RakuAST::RatLiteral

Creates a RakuAST::RatLiteral object from the given value. Assumes the value is really a Rat, does not do any sanity checks.

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite β€” the markup and publishing tools behind this site.