-
-
Save le0nidas/0d0aed1accdfe692862571e48ac3875d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun LessUglyTask.printAssignment() { | |
when { | |
assignedGroup == null && assignedUser == null -> println("\"$name\" is assigned to no one") | |
assignedGroup != null -> println("\"$name\" is assigned to to group: ${assignedGroup.name}") | |
assignedUser != null -> println("\"$name\" is assigned to to user: ${assignedUser.name}") | |
} | |
} | |
val le0nidas = User("le0nidas") | |
val kotlinEnthusiasts = Group("kotlin enthusiasts") | |
LessUglyTask("buy milk").printAssignment() | |
LessUglyTask("write post", assignedUser = le0nidas).printAssignment() | |
LessUglyTask("write kotlin", assignedGroup = kotlinEnthusiasts).printAssignment() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment