Operators
Kotlin supports all common arithmetic operators:
+ for addition
- for subtraction
* for multiplication
/ for division
% for modulus
==============================
You can use them for variables and values in your code:
Output:
42
26
272
4
2
=============================
The comparison operators compare two values and return a boolean: true or false.
For example, 10>5 will return true.
Here are the comparison operators:
> greater than
< less than
>= greater than or equals to
<= less than or equals to
== is equal to
!= is not equal
For example, we can check and output whether the age variable is greater than or equal to 16:
Output:
true
Коментарі