I don’t understand why do i get this error. I retu...
# random
i
I don’t understand why do i get this error. I return integers. Why the heck is resolution ambiguity?
price
is String and i want to count chars that matches
I can write even as at the image
But also get error
Here is working variant…
is it a bug?
r
Why do you type return?
i
At start i didn’t type it, but forgot to leave it after few experiments
r
You might be right though. Anyway you can just workaround it I think, like this:
d
I think that's a bug, kotlin typically assumes bare integers are int and not long.
e
also,
0
is kind of special, since it can represent all the numeric types
i
It's a known problem with type inference for `sumOf`: https://youtrack.jetbrains.com/issue/KT-46360
By the way, you might want to use
count
function to count matches:
count { it = ' ' }
👍🏼 2
👍 1