Operands and operators

An operator is the part of an instruction that specifies the value to be operated on. An operator also carries out a specific operation on its operands. Examples of operators are +, -, *, /, and %. Operators can be categorized based on the type of operations carried out and the number of operands acted upon by the operator.

Based on the type of operations carried out by the operator, we can classify operators into:

  • Relational operators
  • Assignment operators
  • Logical operators
  • Arithmetic operators
  • Bitwise operators

Operator type

Examples

Relational operators

>, <, >=, <=, ==

Assignment operators

+=, -=, *=, /=, =

Logical operators

&&, ||, !

Arithmetic operators

+, -, *, /

Bitwise operators ...

Get Kotlin Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.