- Perl 6 Deep Dive
- Andrew Shitov
- 89字
- 2021-07-03 00:05:51
Getting the Perl representation of the value
The perl method returns a string that can represent the Rat value as Perl 6 understands it in the source code. The result can either contain a decimal point or a slash, depending on what is better for precise representation of the value.
Consider a couple of examples that display the preceding idea:
my $x = 1/3;
say $x.perl; # <1/3>
my $y = 1/2;
say $y.perl; # 0.5
Even more, the following code is valid Perl 6 code:
say 10/20.perl; # 0.5
推薦閱讀
- HoloLens Beginner's Guide
- 算法訓練營:入門篇(全彩版)
- Learning RabbitMQ
- Unity Virtual Reality Projects
- C語言程序設計實踐教程
- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- Jupyter數據科學實戰
- Modern C++ Programming Cookbook
- 機器學習微積分一本通(Python版)
- OpenCV with Python Blueprints
- Building Business Websites with Squarespace 7(Second Edition)
- Mastering ASP.NET Core 2.0
- Java設計模式深入研究
- LabVIEW入門與實戰開發100例(第4版)
- 從零開始學算法:基于Python