Created
June 16, 2020 02:17
-
-
Save GabriellCosta/bbd3527ae18e40bcc0f542811c33a455 to your computer and use it in GitHub Desktop.
Criando obejtos e utilizando eles em um Scratch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Criamos uma classe | |
data class Sample( | |
val number: Int | |
) { | |
//Aqui temos um pequeno override so para exemplificar | |
override fun toString(): String { | |
return "Meu numero é $number" | |
} | |
} | |
//então podemos criar uma lista de itens do tipo | |
val list = listOf(Sample(3), Sample(4), Sample(99)) | |
//E ver facilmente o seu resultado | |
println(list.maxBy { it.number }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment