I have this map `private val routes = mapOf<Reg...
# getting-started
o
I have this map
private val routes = mapOf<Regex, (vararg args: String) -> LaunchAction?>(
I would like to accept a variable number of arguments in that anonymous function defined as the map’s value, how can I do that? I’m not allowed to set a modifier like
vararg
there
y
vararg
is syntatic sugar for Arrays, so use
args: Array<String>
instead like so:
Copy code
private val routes = mapOf<Regex, (args: Array<String>) -> LaunchAction?>(
o
oh..
lol ok TIL
thanks
👍 1
y
I'm assuming that they're already using
vararg
elsewhere and so they expect arrays everywhere