Summary

  • bool is a type with two possible values: true and false

  • true and false are both literals

  • You can use the assert! macro to make sure expressions evaluate to true

  • You can use the six comparison operators to compare values and get bool results

  • Functions can return bools, just like they can return i32s and other types

  • The ! is the not operator, and it changes true to false and false to true

  • 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.