The document contains code snippets demonstrating various Kotlin functions including string concatenation, conditional logic to find the greatest of three numbers, a for loop to print numbers 1 through 10, printing the current date and time, using lambda functions to manipulate a list, and a note that enhancements cannot be used.
The document contains code snippets demonstrating various Kotlin functions including string concatenation, conditional logic to find the greatest of three numbers, a for loop to print numbers 1 through 10, printing the current date and time, using lambda functions to manipulate a list, and a note that enhancements cannot be used.
The document contains code snippets demonstrating various Kotlin functions including string concatenation, conditional logic to find the greatest of three numbers, a for loop to print numbers 1 through 10, printing the current date and time, using lambda functions to manipulate a list, and a note that enhancements cannot be used.
// concat // var num = var one : var ans = print(num
string with declaration
"The number to print is" float = 1.29f "times less than the original" + " " + one + " " + ans)
// finding greater of 3 numbers
var x = 5 var y = 6 var z = 7 if(x > y && x > z) { print("x is greater") } else if (y > x && y > z) { print("y is greater") } else { print("z is greater") } //printing 1 to 10 numbers in for loop for(i in 0|..10) { print(i) } // printing date var date = new Date() print("Current date and time is : " + date) // using lambda function var los = {"This", "is", "a", "list"} var p = los.toString() var r = los.where( \ s -> s.length > 0 ) .map( \ s -> s.toUpperCase() ) .orderBy(\ s -> s ) print( p + "\n"+r.join(" ") ) var q = los.where( \ s -> s.length > 0 ) .map( \ s -> s.toLowerCase() ) .orderByDescending( \ s -> s ) print(q.join(" ")) // not able to use enhancements