Select Page

Kotlin Multiplatform Mobile

Kotlin Multiplatform Mobile KMM ist ein Software Development Kit (Sammlung von Programmierwerkzeugen) um auf  iOS und Android (möglichst) plattformunabhängig Software zu entwickeln. Nach eigenen Angaben wir Kotlin z.B. von Philips und Netflix verwendet.

Wichtige Befehle

if Verzweigung

if (bedingung) {
     // dieser Code wird ausführt, wenn die Bedingung erfüllt ist
   }
else {
     // wenn die Bedingung nicht erfüllt wird, wird dieser Code ausgeführt
}

while

while (bedingung<10) {
     // Code
     i++
   }

when

val y = when {
     x>3 -> 1
     else -> 0
   }

for

var x = arrayOf(5,1,2,4,3)
for (x in num) {
   println(x)
}

break

while (i <= 17) {
   sum += 1
   i++
   if(sum>17)
   {break}
}

continue (das Gegenteil von break)

while (i <= 17) {
   i++
   if (i%2 == 0){
      continue}
   sum += i
}

arrays (Felder)

var contacts = arrayOf(‘John’, ‘Matthew’,’Mark’,’Luke’)
println(contacts[4])

ranges

for (i in 3..8) {
   println(i)}
for (i in 1 until 5){
   println(i)}
for(x in ‘a’..’e’){
println(x)}