September 2017
Beginner
402 pages
9h 52m
English
The two methods—re and im—return real and imaginary parts of the complex number, as follows:
my $z = 4+5i;say $z.re; # 4say $z.im; # 5
The imaginary part is returned without the variable i.
The reals method returns a list containing both values, as shown here:
my $z = 4+5i;say $z.reals; # (4 5)
Read now
Unlock full access