Skip to content

Commit

Permalink
Adds documentation for Unicode superscript ops closes #1098
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Jul 25, 2018
1 parent 29a0d08 commit 2de1193
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/Language/operators.pod6
Expand Up @@ -877,6 +877,17 @@ If the right-hand side is a non-negative integer and the left-hand side
is an arbitrary precision type (L<Int>, L<FatRat>), then the calculation
is carried out without loss of precision.
Unicode superscripts will behave in exactly the same way.
sub squared( Int $num ) { $num² };
say squared($_) for ^5; OUTPUT: «0␤1␤4␤9␤16␤»
It also works for sequences of several Unicode superscript numbers
sub twentytwoed( Int $num ) { $num²² };
say twentytwoed($_) for ^5; # OUTPUT: «0␤1␤4194304␤31381059609␤17592186044416␤»
=head1 Symbolic unary precedence
=head2 prefix C«?»
Expand Down

0 comments on commit 2de1193

Please sign in to comment.