- Kotlin Programming By Example
- Iyanu Adelekan
- 172字
- 2021-08-27 20:00:07
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 |
and(bits), or(bits), xor(bits), inv(), shl(bits), shr(bits), ushr(bits) |
Based on the number of operands acted upon, we have two main types of operators in Kotlin:
- Unary operators
- Binary operators
Operator type |
Description |
Examples |
Unary operator |
Requires only one operand |
!, ++, - - |
Binary operator |
Requires two operands |
+, -, *, /, %, &&, || |
- OpenNI Cookbook
- Magento 2 Development Cookbook
- Functional Programming in JavaScript
- 手把手教你學C語言
- iOS應用逆向工程(第2版)
- PLC編程與調試技術(松下系列)
- 快速念咒:MySQL入門指南與進階實戰
- Java程序設計
- Web Development with MongoDB and Node(Third Edition)
- iOS開發實戰:從入門到上架App Store(第2版) (移動開發叢書)
- 匯編語言編程基礎:基于LoongArch
- HTML5+CSS3+JavaScript 從入門到項目實踐(超值版)
- Python GUI Programming Cookbook(Second Edition)
- 原型設計:打造成功產品的實用方法及實踐
- Spring MVC Blueprints