routine pred
1 | enum Bool |
1.1 | (Bool) routine pred |
2 | class Date |
2.1 | (Date) method pred |
3 | role Enumeration |
3.1 | (Enumeration) method pred |
4 | class Str |
4.1 | (Str) method pred |
5 | class Numeric |
5.1 | (Numeric) method pred |
6 | class IO::Path |
6.1 | (IO::Path) method pred |
Documentation for routine pred
assembled from the following types:
enum Bool
From Bool
(Bool) routine pred
method pred(--> Bool)
Returns False
.
say True.pred; # OUTPUT: «False»say False.pred; # OUTPUT: «False»
pred
is short for "predecessor"; it returns the previous enum value. Bool is a special enum with only two values, False
and True
. When sorted, False
comes first, so False
is the predecessor to True
. And since False
is the "lowest" Bool enum value, its own predecessor is also False
.
class Date
From Date
(Date) method pred
Defined as:
method pred(Date: --> Date)
Returns a Date
of the previous day. "pred" is short for "predecessor".
say Date.new("2016-01-01").pred; # OUTPUT: «2015-12-31»
role Enumeration
From Enumeration
(Enumeration) method pred
Defined as:
method pred(::?CLASS:)
say Freija.pred; # OUTPUT: «Oðin»
class Str
From Str
(Str) method pred
method pred(Str: --> Str)
Returns the string decremented by one.
String decrementing is "magical" just like string increment (see succ). It fails on underflow
'b0'.pred; # RESULT: «a9»'a0'.pred; # Failure'img002.png'.pred; # RESULT: «img001.png»
class Numeric
From Numeric
(Numeric) method pred
method pred(Numeric:)
Returns the number decremented by one (predecessor).
class IO::Path
From IO::Path
(IO::Path) method pred
Defined as:
method pred(IO::Path: --> IO::Path)
Returns a new IO::Path constructed from the invocant, with .basename
changed by calling Str.pred
on it.
"foo/file02.txt".IO.pred.say; # OUTPUT: «"foo/file01.txt".IO»