官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 菏泽市| 奉化市| 五大连池市| 吐鲁番市| 梧州市| 汉寿县| 凤城市| 嘉黎县| 囊谦县| 紫云| 富锦市| 青州市| 拜泉县| 来安县| 大方县| 舒城县| 涪陵区| 顺平县| 正镶白旗| 晴隆县| 铜陵市| 丽水市| 刚察县| 石河子市| 苍南县| 昌宁县| 阳高县| 民乐县| 禄劝| 镇平县| 沭阳县| 定边县| 定远县| 昭平县| 达日县| 灵石县| 大冶市| 新野县| 华阴市| 宁夏| 梓潼县|