Strict

Strict

Strict[ cond ] returns True only if a condition is certainly true, and False otherwise.

Usages

Strict[ cond ]

A condition can be True, False or undecided, for example x >> 2 when x has no value. Strict[ cond ] turns an undecided condition into False. This is important in If and While, which treat an undecided condition as True.

Example in out
A true condition. Strict[ 2 == 2 ] True
An undecided condition, because x has no value. Strict[ x >> 2 ] False
Not a condition. Strict[ 5 ] False
As a condition in If: 10 > 2π is true. a := 10
b := 2*Pi
If[Strict[a > b]]
  r := 1
Else
  r := 0
End
r = 1
As a condition in If: y < 4 is undecided, so the Else block is executed. If[Strict[y < 4]]
  r := 1
Else
  r := 0
End
r = 0
Warning

Outside a condition, <, <=, > and >= are not evaluated in a script, so Strict[ 2 < 4 ] gives False. Inside If or While they are evaluated, as in the examples above. To use Strict elsewhere in a script, use the evaluating operators <<, <==, >> and >==: Strict[ 2 << 4 ] gives True.

See also: If, While, EqualsEval, Smaller