andyg
06/05/2020, 6:17 AMwhen
statement dynamically from a map, or two arrays/lists? something like
val teamMap : Map<String, String> = mapOf("Yankees" to "baseball", "Cowboys" to "football", "Lakers" to "basketball")
val sport : String = when {
teamMap.map { e -> mystring.contains(e.key) -> e.value }
}
also a value for else
would need to be supplied, not sure the best wayEvan R.
06/05/2020, 11:49 AMandyg
06/05/2020, 10:45 PMwhen
statement so didn't even think of accessing the map directly