Skip to content

Instantly share code, notes, and snippets.

@davidkathoh
davidkathoh / valvar.kt
Last active July 13, 2019 09:00
difference between val and var
val dateOfBirth = "17 Mars ,1078"
dateOfBirth = "05 Avril, 1089" //erreur
var age = 23
age = 28 //pas de probleme
@davidkathoh
davidkathoh / valuetype.kt
Created July 13, 2019 09:03
variable value type
var age = 12
age = "douze"// erreur
@davidkathoh
davidkathoh / init.kt
Created July 13, 2019 09:04
late initialization
val phoneModel: String
phoneModel = "Techno" // pas d'erreur
@davidkathoh
davidkathoh / declaration.kt
Last active July 13, 2019 09:28
different line for variable declaration
val langue = "Lingala", pays = "RD Congo" // erreur
val langue = "Lingala"
val pays = "RD Congo"
@davidkathoh
davidkathoh / numeric.kt
Created July 13, 2019 09:11
Variable de type numerique
val monInt = 20
val monLong = 300L
val monFloat = 24.43F
val monDouble = 61.89
val monHexadecimal = 0X0F
val monBinary = 0b010101
val monLong = 57L
val monLongEncore :Long = 57
val myNumber = 1000
val myNumberAgain: Long = myNumber //erreur : Type mismatch
val monInt = 767
val monLong = monInt.toLong()
@davidkathoh
davidkathoh / comments.kt
Created July 13, 2019 09:29
Commentaire en Kotlin
/*
salut , ceci est un block de commenatire
il s'etant sur plusieurs ligne.
vous pouvez ecrire autant que vous voulez
*/
//ceci est un commentaire uniligne
val unLongMots = "Anticonstitutionelement"
val message = "le plus long mot en francais est compose de ${longWord.leght} lettres "