Keyword true[−][src]
Expand description
A value of type bool representing logical true.
Logically true is not equal to false.
Control structures that check for true
Several of Rust’s control structures will check for a bool condition evaluating to true.
-
The condition in an
ifexpression must be of typebool. Whenever that condition evaluates to true, theifexpression takes on the value of the first block. If however, the condition evaluates tofalse, the expression takes on value of theelseblock if there is one. -
whileis another control flow construct expecting abool-typed condition. As long as the condition evaluates to true, thewhileloop will continually evaluate its associated block. -
matcharms can have guard clauses on them.