hello i’m trying to the subtotal of half the objects in my enum class. the enum class is called Scroregroup and it’s split into two groups which are is Upper True or False. im trying to add up the values of the isUpper true sectio of the enum class.
enum class ScoreGroup(val isUpper: Boolean) {
ONES(true),
TWOS(true),
THREES(true),
FOURS(true),
FIVES(true),
SIXES(true),
THREE_OF_A_KIND(false),
FOUR_OF_A_KIND(false),
FULL_HOUSE(false),
SMALL_STRAIGHT(false),
LARGE_STRAIGHT(false),
YAHTZEE(false),
CHANCE(false);
val isLower: Boolean get() = ! isUpper
override val upperSubTotal: Int = {this = listOf( ScoreGroup.entries.filter { it.isUpper })}.
John Joco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.