Summary
-
bool
is a type with two possible values:true
andfalse
-
true
andfalse
are both literals -
You can use the
assert!
macro to make sure expressions evaluate totrue
-
You can use the six comparison operators to compare values and get
bool
results -
Functions can return
bool
s, just like they can returni32
s and other types -
The
!
is the not operator, and it changestrue
tofalse
andfalse
totrue
-
The six comparison operators form three pairs of operators that are the opposite of each other
-
&&
is the and operator, and||
is the or operator
Get hands-on with 1400+ tech skills courses.