unless-then {postlogic} | R Documentation |
Infix unless-then logic
Description
These give logic that can be used as a qualifying statement that occurs after the value statement. Take note that the ' as other custom infix operators and so care should be taken that the effect is as desired.
Usage
prior %unless% proposition
prior %unless% proposition %then% alternate
Arguments
prior |
Value to be returned unless proposition returns FALSE. |
proposition |
The logical statement to condition on. |
alternate |
When proposition returns true and the the alternate value is returned. |
prior %unless% proposition |
An |
See Also
Other postlogic: if-otherwise
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 :(
[Package postlogic version 0.1.0.1 Index]