- Perl 6 Deep Dive
- Andrew Shitov
- 66字
- 2021-07-03 00:05:54
Getting real and imaginary parts
The two methods—re and im—return real and imaginary parts of the complex number, as follows:
my $z = 4+5i;
say $z.re; # 4
say $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)
推薦閱讀
- Functional Python Programming
- Photoshop智能手機(jī)APP UI設(shè)計(jì)之道
- Python程序設(shè)計(jì)(第3版)
- Learning C++ Functional Programming
- JavaScript+jQuery開發(fā)實(shí)戰(zhàn)
- Java FX應(yīng)用開發(fā)教程
- Python程序設(shè)計(jì)案例教程
- SAS數(shù)據(jù)統(tǒng)計(jì)分析與編程實(shí)踐
- Effective Python Penetration Testing
- Python機(jī)器學(xué)習(xí)實(shí)戰(zhàn)
- 深入淺出RxJS
- 深入淺出Serverless:技術(shù)原理與應(yīng)用實(shí)踐
- Mastering JavaScript High Performance
- Spring快速入門
- Kubernetes進(jìn)階實(shí)戰(zhàn)