GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Introduction
  • Reference
  • Miscellaneous
  • Types
  • Routines
  • Raku®
  • Chat
  • More
  • About
  • Report an issue with this site
  • Report an issue with the documentation content
  • RakuDocumentation.epub
  • EPUB v3 specification
  • License

This view

  • Original page
  • New address

GeezerVison is showing docs.raku.org — pred | Raku Documentation

This is an automatically generated page and cannot be edited directly. Text in Composite pages, (URLs starting with 'routine' or 'syntax') can be edited by clicking on the link labeled 'in context', and editing the text there.

Exit this popup by pressing <Escape>, or clicking on X or on the background.

  • Table of Contents
  • Index
  • In role Numeric
  • In IO::Path
  • In Str
  • In enum Bool
  • In role Enumeration
  • In Allomorph
  • In Date
pred
Combined from primary sources listed below.

In role Numeric§

See primary documentation in context for method pred.

Raku highlighting
method pred(Numeric:D:)

Returns the number decremented by one (predecessor).

In IO::Path§

See primary documentation in context for method pred.

Raku highlighting
method pred(IO::Path:D: --> IO::Path:D)

Returns a new IO::Path constructed from the invocant, with .basename changed by calling Str.pred on it.

Raku highlighting
"foo/file02.txt".IO.pred.say; # OUTPUT: «"foo/file01.txt".IO␤»

In Str§

See primary documentation in context for method pred.

Raku highlighting
method pred(Str:D: --> Str:D)

Returns the string decremented by one.

String decrementing is "magical" just like string increment (see succ). It fails on underflow

Raku highlighting
'b0'.pred;           # OUTPUT: «a9»
'a0'.pred;           # OUTPUT: Failure
'img002.png'.pred;   # OUTPUT: «img001.png»

In enum Bool§

See primary documentation in context for routine pred.

Raku highlighting
method pred(--> Bool:D)

Returns False.

Raku highlighting
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.

In role Enumeration§

See primary documentation in context for method pred.

Raku highlighting
method pred(::?CLASS:D:)
Raku highlighting
say Freija.pred;  # OUTPUT: «Oðin␤»

In Allomorph§

See primary documentation in context for method pred.

Raku highlighting
method pred(Allomorph:D:)

Calls Numeric.pred on the invocant's numeric value.

In Date§

See primary documentation in context for method pred.

Raku highlighting
method pred(Date:D: --> Date:D)

Returns a Date of the previous day. "pred" is short for "predecessor".

Raku highlighting
say Date.new("2016-01-01").pred;   # OUTPUT: «2015-12-31␤»
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.