![]() ![]() Find more details in the course’s Quickstart Guide Atomic Kotlin Atomic Kotlin is the book by Bruce Eckel and Svetlana Isakova that comes with learning resources. However I tried printing the collection with and without joinOptions(), and they both have the same outcome: val collection: Collection = listOf(1, 2, 3)įun joinNumbers(numbers: Collection) = numbers. The Kotlin Koans course is a series of exercises specially designed to get you familiar with the Kotlin syntax. The answer: fun joinOptions(options: Collection) = options.joinToString(prefix = "")Īdds "" to the end of the collection. Specifying only twoĪrguments make the function joinOptions() return the list in a JSON It can be called on a collection of Strings. Kotlin is a powerful and extensible programming language created by Jetbrains, the same company that created IntelliJ Idea which powers Android Studio today. The libraryįunction joinToString is declared with default values for parameters: fun joinToString( Lateinit Lateinit digunakan ketika kita ingin membuat non-null type tapi kita menginisiasikannya. I'm practising Kotlin on Kotlin Koans and am up to the Named Arguments question.ĭefault and named arguments help to minimize the number of overloadsĪnd improve the readability of the function invocation. Kotlin Koans Introduction Convention Collection Property -> Sekarang anda Berada disini 1. kotlin-koans-1-intro.kt / My answers to Kotlin Playground Koans ( / / Intro / // Hello, world fun start (): String 'OK' // Named arguments fun joinOptions ( options: Collection < String >) options.![]()
0 Comments
Leave a Reply. |