Guest User

Untitled

a guest
Jan 23rd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. fun basicWhen() {
  2. val employees = createEmployees()
  3. employees.forEach {
  4. when (it.name) {
  5. "Bongani" -> println("${it.name} is in charge")
  6. null -> println("Employee ${it.number} is a number, not a free man")
  7. //replaces "default" case
  8. else -> println("${it.name} is present")
  9. }
  10. }
  11. }
Add Comment
Please, Sign In to add comment