+ 1
Incomptable Type
I don't know what the error is , and where is Boolean exist in this code . Anybody can solve this error https://code.sololearn.com/c9nT93RoSHJY/?ref=app
3 Réponses
+ 2
I think you are using the when in a wrong way, if i check with the sololearn lessons, it should look more like this:
val result = when {
size==1 -> msg+list.first()
size>=2 -> msg+list.joinToString("and")
else -> msg+list.subList(0,size-2).joinToString(",")+"and "+list.last()
}
return result
and the second condition should be size>=2
+ 1
The when(size) should be when.
+ 1