Operators such as addition +, string concatenation .., and even the assignment operator = have been used throughout this book. Let's take some time to cover in detail what operators are and how they work. Operators fall into one of the following categories:
- Arithmetic operators do math.
- Relational operators always return a Boolean value: true or false. Relational operators are used to compare the relationship between two things, for example, by checking whether one number is smaller than another number.
- Logical operators express complex relations such as and/or. For example, logical operations can be used to check whether a number is less than seven AND greater than two.
- Misc operators: All other operators, such as assignment, fall into this category.
Operators can be unary or binary. A unary operation works on only one operand. For example, the minus sign (...