unless-then: Infix unless-then logic

Description Usage Arguments See Also Examples

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

1
2
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 %if% statement.

See Also

Other postlogic: if-otherwise

Examples

1
2
3
4
5
6
7
    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 :(

postlogic documentation built on Jan. 11, 2020, 9:35 a.m.