File: unless-then.Rd

package info (click to toggle)
r-cran-postlogic 0.1.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 112 kB
  • sloc: sh: 13; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 1,104 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
\name{unless-then}
\alias{unless-then}
\alias{\%unless\%}
\alias{\%then\%}
\title{Infix unless-then logic}
\usage{
prior \%unless\% proposition
prior \%unless\% proposition \%then\% alternate
}
\arguments{
\item{prior}{Value to be returned unless proposition returns FALSE.}

\item{proposition}{The logical statement to condition on.}

\item{alternate}{When proposition returns true and the %then% is provided
the alternate value is returned.}

\item{prior \%unless\% proposition}{An \code{\%if\%} statement.}
}
\description{
These give logic that can be used as a qualifying statement that occurs after the
value statement.
Take note that the `%unless%` and `%then%` operators follow the same order of operations
as other custom infix operators and so care should be taken that the effect is as desired.
}
\examples{
    x <- 4
    x <- sqrt(x) \%unless\% is.complex(x) \%then\% "This is too hard :("
    x # 2

    x <- 4i
    x <- sqrt(x) \%unless\% is.complex(x) \%then\% "This is too hard :("
    x # This is too hard :(
}
\seealso{
Other postlogic: \code{\link{if-otherwise}}
}
\concept{postlogic}