Pro Android with Kotlin


CHAPTER 10: Development


Download 5.42 Mb.
Pdf ko'rish
bet216/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   212   213   214   215   216   217   218   219   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile



274
CHAPTER 10: Development
Table 10-2. Kotlin Operators
Symbol
Translates to
Infix
Default Function
+a
a.unaryPlus()
Usually does nothing.
-a
a.unaryMinus()
Negates a number.
!a
a.not()
Negates a Boolean expression.
a++
a.inc()
Increments a number.
a- -
a.dec()
Decrements a number.
a + b
a.plus(b)
x
Addition.
a - b
a.minus(b)
x
Subtraction
a * b
a.times(b)
x
Multiplication.
a / b
a.div(b)
x
Division.
a % b
a.rem(b)
x
Remainder after division.
a . . b
a.rangeTo(b)
x
Defines a range.
a in b
b.contains(a)
x
Containment check.
a !in b
!b.contains(a)
x
Not-containment check.
a[i]
a.get(i)
Indexed access.
a[i,j,...]
a.get(i,j,...)
Indexed access, normally not used.
a[i] = b
a.set(i,b)
Indexed setting access.
a[i,j,...] = b
a.set(i,j,...,b)
Indexed setting access, normally not 
used.
a()
a.invoke()
Invocation.
a(b)
a.invoke(b)
Invocation.
a(b,c,...)
a.invoke(b,c,...)
Invocation.
a += b
a.plusAssign(b)
x
Adds to a. Must not return a value; 
instead, you must modify this.
a -= b
a.minusAssign(b)
x
Subtracts from a. Must not return a 
value; instead, you must modify this.
a *= b
a.timesAssign()
x
Multiplies to a. Must not return a value; 
instead, you must modify this.
a /= b
a.divAssign(b)
x
Divides a by b and then assigns. Must 
not return a value; instead, you must 
modify this.
a %= b
a.remAssign(b)
x
Takes the remainder of the division by 
b and then assigns. Must not return a 
value; instead, you must modify this.
a == b
a?.equals(b) ?: (b 
=== null)
x
Checks equality.
(continued)



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   212   213   214   215   216   217   218   219   ...   223




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling