Atividades realizadas durante o bootcamp Dev Venture
-
Atividades
-
-
Soma dos valores de um array
fun simpleArraySum(ar: Array<Int>): Int = ar.sum()
-
-
- Introdução
-
fun joinOptions(options: Collection<String>) = options.joinToString(prefix= "[", postfix = "]")
-
fun foo(name: String, number: Int = 42, toUpperCase: Boolean = false) = (if (toUpperCase) name.uppercase() else name) + number
-
val tripleQuotedString = """ #question = "$question" #answer = $answer""".trimMargin("#")
-
fun getPattern(): String = """\d{2} $month \d{4}"""
-
fun sendMessageToClient(client: Client?, message: String?, mailer: Mailer) { val personalInfo = client?.personalInfo val email = personalInfo?.email if(email == null || message == null) return mailer.sendMessage(email, message) }
-
fun failWithWrongAge(age: Int?): Nothing { throw IllegalArgumentException("Wrong age: $age") }
-
fun containsEven(collection: Collection<Int>): Boolean = collection.any { it % 2 == 0 }
-
- Introdução
-
-
Desafios