On this page
Keyword true
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
if
expression must be of typebool
. Whenever that condition evaluates to true, theif
expression takes on the value of the first block. If however, the condition evaluates tofalse
, the expression takes on value of theelse
block if there is one.while
is another control flow construct expecting abool
-typed condition. As long as the condition evaluates to true, thewhile
loop will continually evaluate its associated block.match
arms can have guard clauses on them.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/keyword.true.html