Skip to content

Instantly share code, notes, and snippets.

@labibmuhajir
Created December 13, 2019 15:52
Show Gist options
  • Save labibmuhajir/86852ec05d6d5b7ff7b8b509e6068838 to your computer and use it in GitHub Desktop.
Save labibmuhajir/86852ec05d6d5b7ff7b8b509e6068838 to your computer and use it in GitHub Desktop.
example
/**
* You can edit, run, and share this code.
* play.kotlinlang.org
*/
fun main() {
val siswa1 = Siswa(Modules.nama)
val siswa2 = Siswa(Modules.module.get("nama"), Modules.module.get("kelas"))
println("siswa 1 nama: " + siswa1.nama)
println("siswa 2 kelas: " + siswa2.kelas)
}
object Modules{
val nama = "Budi"
val module = mapOf<String, String>(
"nama" to "Budi",
"kelas" to "9"
)
}
data class Siswa(val nama: String? = null, val kelas: String? = null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment