statement dynamically from a map, or two arrays/lists? something like
Copy code
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 way
e
Evan R.
06/05/2020, 11:49 AM
You don’t need a when statement, you can just do it like this: