- 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.
推薦閱讀
- C語言程序設(shè)計(第3版)
- 移動UI設(shè)計(微課版)
- 編程的修煉
- 零基礎(chǔ)PHP學(xué)習(xí)筆記
- Java技術(shù)手冊(原書第7版)
- Data Analysis with Stata
- 軟件工程
- AutoCAD VBA參數(shù)化繪圖程序開發(fā)與實(shí)戰(zhàn)編碼
- Python數(shù)據(jù)結(jié)構(gòu)與算法(視頻教學(xué)版)
- 從零開始學(xué)Linux編程
- The Professional ScrumMaster’s Handbook
- 現(xiàn)代C++編程實(shí)戰(zhàn):132個核心技巧示例(原書第2版)
- MySQL入門很輕松(微課超值版)
- Hadoop 2.X HDFS源碼剖析
- Python大規(guī)模機(jī)器學(xué)習(xí)