IMAM00

lambda_function_Day_6

Mar 26th, 2022 (edited)
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.46 KB | None | 0 0
  1. fun main() {
  2.     printName("Hello","World") // calling the lamda fucnction
  3.     demo("Just a demo")// calling the simple function
  4. }
  5. val printName:(String,String)->Unit={ // inside the (), two arguments, after -> return type
  6.         message,msg->println("$message $msg") // here message, msg are arguments and after -> return statement
  7. }
  8. fun demo(name:String):Unit{
  9.     println("It's just a demo of kotlin function\n$name"  ) // to remember simple kotlin function :)
  10. }
Add Comment
Please, Sign In to add comment