fun main(){ val options =listOf("hello", "World") val output =joinOptions(options)println("Printing ${output}")// prints[Hello, World]}fun joinOptions(options:Collection<String>)= options.joinToString(prefix="[", postfix="]")
#3 Function with default argument
fun foo(name:String, number:Int=42, toUpperCase: Boolean =false)=(if(toUpperCase){ name.uppercase()}else{ name})+ numberfun useFoo()=listOf(foo("a"),foo("b", number =1),foo("c", toUpperCase =true),foo(name ="d", number =2, toUpperCase =true))