Search⌘ K

Comparison Operators

Explore the six primary comparison operators in Rust and how they apply to data types like strings, numbers, and booleans. Learn to use these operators with assert macros to validate conditions in your programs.

We'll cover the following...

We’ve seen == and < so far. Let’s document all six of the comparison operators we have at our disposal.

  • ==
    equals

  • !=
    not equals ...