- 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.
推薦閱讀
- Redis Applied Design Patterns
- Visual FoxPro程序設(shè)計(jì)教程
- SQL Server 2016從入門到精通(視頻教學(xué)超值版)
- Hands-On Image Processing with Python
- Windows系統(tǒng)管理與服務(wù)配置
- R語言數(shù)據(jù)可視化之美:專業(yè)圖表繪制指南
- Unity Virtual Reality Projects
- Object-Oriented JavaScript(Second Edition)
- The HTML and CSS Workshop
- 深入分布式緩存:從原理到實(shí)踐
- 微服務(wù)從小白到專家:Spring Cloud和Kubernetes實(shí)戰(zhàn)
- Mastering C++ Multithreading
- Essential C++(中文版)
- OpenCV 3計(jì)算機(jī)視覺:Python語言實(shí)現(xiàn)(原書第2版)
- Java程序設(shè)計(jì)教程