Advertisement
miguelmartins1987

Brief Kotlin example #1

Nov 5th, 2020
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.43 KB | None | 0 0
  1. fun login(user: String, password: String) {
  2.     if (user.isEmpty()) {
  3.         println("Empty user not allowed.")
  4.         return
  5.     }
  6.    
  7.     if (password.isEmpty()) {
  8.         println("Empty password not allowed.")
  9.         return
  10.     }
  11.    
  12.     println("User: ${user}")
  13.     println("Password: ${password}")
  14. }
  15.  
  16. fun main(args: Array<String>) {
  17.     login("", "")
  18.     login("my_user", "")
  19.     login("my_user", "my_password")
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement