Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun basicWhen() {
- val employees = createEmployees()
- employees.forEach {
- when (it.name) {
- "Bongani" -> println("${it.name} is in charge")
- null -> println("Employee ${it.number} is a number, not a free man")
- //replaces "default" case
- else -> println("${it.name} is present")
- }
- }
- }
Add Comment
Please, Sign In to add comment