- Perl 6 Deep Dive
- Andrew Shitov
- 71字
- 2021-07-03 00:05:50
Getting the next and previous values
The two methods, pred and succ, correspondingly return the previous and the next values for integer arguments:
say 42.pred; # 41
say 42.succ; # 43
This method also works with non-integer values, when they add or subtract 1, as shown in the next fragment:
say pi.pred; # 2.14159265358979
say (3/4).succ; # 1.75
The names of the methods come from the words predecessor and successor.
推薦閱讀
- 實用防銹油配方與制備200例
- 網頁設計與制作教程(HTML+CSS+JavaScript)(第2版)
- 你必須知道的204個Visual C++開發問題
- MySQL數據庫管理與開發(慕課版)
- 網站構建技術
- Asynchronous Android Programming(Second Edition)
- Tableau 10 Bootcamp
- Test-Driven Machine Learning
- Service Mesh實戰:基于Linkerd和Kubernetes的微服務實踐
- Modern C++ Programming Cookbook
- Android應用開發深入學習實錄
- Learning Ionic
- PHP項目開發全程實錄(第4版)
- Professional JavaScript
- 數據庫技術及應用教程上機指導與習題(第2版)