Topic
Chars, Bools & Unit Types
Three small types that show up everywhere in Rust. char holds a single character, bool holds true or false, and () means a function returned nothing.
Quick Reference
ConceptWhat it means
charA single character, always in single quotes like 'A'
boolEither true or false, nothing in between
!Flips a bool to its opposite
&&True only when both sides are true
||True when either side is true
()The unit type, returned by functions that return nothing
TermWhat it meansWhen you use it
charA single character, always in single quotes, 4 bytesSingle letters, symbols, emoji
boolEither true or false, 1 byteStatus flags: is_active, is_paid, is_valid
!NOT operator, flips a bool to its oppositeWhen you need the opposite of a condition
&&AND operator, true only when both sides are trueRequiring multiple conditions to pass together
||OR operator, true when either side is trueAccepting any one of several conditions
()The unit type, holds nothing, size 0 bytesReturn type of functions that do something but return nothing