Kotlin     PHP       WEB       3GL   4GL   5GL      

Kotlin

Kotlin

Kotlin , , . , .. , . : , , .

Kotlin , Java, . , , .

Kotlin ( Java):

Double 64
Float 32
Long 64
Int 32
Short 16
Byte 8

, (characters) Kotlin ( Java).

Kotlin () :

: .

Kotlin :

Java JVM; , null (, Int?), . .

, :

val a: Int = 10000
print(a === a) // Prints 'true'
val boxedA: Int? = a
val anotherBoxedA: Int? = a
print(boxedA === anotherBoxedA) // !!!Prints 'false'!!!

, :

val a: Int = 10000
print(a == a) // Prints 'true'
val boxedA: Int? = a
val anotherBoxedA: Int? = a
print(boxedA == anotherBoxedA) // Prints 'true'

- . , :

//  ,      :
val a: Int? = 1 // "" Int (java.lang.Integer)
val b: Long? = a //    "" Long (java.lang.Long)
print(a == b) // !    "false" . .  equals()  Long ,        Long

, ( ), .

, . , Byte Int :

val b: Byte = 1 // ,   
val i: Int = b // 

""

val i: Int = b.toInt() // :   

:

, , , :

val l = 1L + 3 // Long + Int => Long

Kotlin , ( , ). . .

, , , :

val x = (1 shl 2) and 0x000FF000

( Int Long):

Kotlin Char.

fun check(c: Char) {
  if (c == 1) { // :  
    // ...
  }
}

: '1', '\n', '\uFF00'. Int

fun decimalDigitValue(c: Char): Int {
  if (c !in '0'..'9')
    throw IllegalArgumentException(" ")
  return c.toInt() - '0'.toInt() //    
}

, nullable . ( ) .

Boolean : true false.

nullable .

Kotlin Array, get set ( [] ), size, :

class Array<T> private constructor() {
  val size: Int
  fun get(index: Int): T
  fun set(index: Int, value: T): Unit

  fun iterator(): Iterator<T>
  // ...
}

arrayOf(), , .. arrayOf(1, 2, 3) [1, 2, 3]. arrayOfNulls() , null.

, , :

//    Array<String>   ["0", "1", "4", "9", "16"]
val asc = Array(5, { i -> (i * i).toString() })

, [] get() set().

: Java Kotlin . , Kotlin Array<String> Array<Any>, ( Array<out Any>, . Type Projections).

Kotlin : ByteArray, ShortArray, IntArray .. Array, . :

val x: IntArray = intArrayOf(1, 2, 3)
x[0] = x[1] + x[2]

Kotlin String. . , : s[i]. for:

for (c in str) {
  println(c)
}

Kotlin : , . Java:

val s = "Hello, world!\n"

, .

("""), , :

val text = """
  for (c in "foo")
    print(c)
"""

, .. , , . ($) (, ):

val i = 10
val s = "i = $i" // evaluates to "i = 10"

:

val s = "abc"
val str = "$s.length is ${s.length}" // evaluates to "abc.length is 3"

, . $ :

val price = "${'$'}9.99"
Kotlin     PHP       WEB       3GL   4GL   5GL         w  

, - , . , , , .. , . . , " ".




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution