Print the value of π.
The value of is accessible with no additional modules:
This instruction, not a surprise, prints the desired value:
As you may have noticed, a non-ASCII character was used in the code. Perl 6 assumes that the source code is encoded as UTF-8 by default. Instead, a non-Unicode version can be used, too:
There are a couple more constants built-in in Perl 6:
e; both of them have Unicode variants: and (character code
The value of
tau is equal to 2π, and the above program prints the following result:
It is also worth knowing that in Perl 6, there’s a special constant for presenting infinity:
∞. This number is bigger than any other (reasonably big) number; either an integer or a floating-point value.
say 1E120 < ∞; # Prints True