September 2017
Beginner
402 pages
9h 52m
English
The * and / operators are the operators for multiplication and division. Their operands are converted to the numeric type if necessary. Consider the following examples:
say 10 * 20;say "10" * "20";
Both lines of code print 200. Although, in the first line, the operands of the multiplication operator were both numeric (more precisely, Int). In the second line, we are trying to multiply strings containing numbers. Perl 6 converts the strings for us to make them numbers, and then the * operator does its work.
The * and / operators work well with the floating-point and with complex numbers (because both the Num and Complex types implement the Numeric role):
say pi * e; # 8.53973422267357say (10+3i) * ...
Read now
Unlock full access