- 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)
推薦閱讀
- GAE編程指南
- Python 深度學習
- Cross-platform Desktop Application Development:Electron,Node,NW.js,and React
- 深入實踐Spring Boot
- Python GUI Programming Cookbook
- Creating Mobile Apps with jQuery Mobile(Second Edition)
- Service Mesh實戰:基于Linkerd和Kubernetes的微服務實踐
- SQL 經典實例
- Visual Basic程序設計習題與上機實踐
- 寫給程序員的Python教程
- Java程序設計教程
- 百萬在線:大型游戲服務端開發
- 零基礎學Java第2版
- C語言程序設計與應用實驗指導書(第2版)
- C# 7.0本質論