https://kotlinlang.org logo
h

Hullaballoonatic

07/14/2020, 11:14 PM
When i first started my job as a c# developer, I really missed kotlin, because it felt like kotlin had everything c# did and then some, but now there are a handful of things from c# i'd love to see in kotlin:
Copy code
val last3 = myList[^3..]
val first3 = myList[..3]

when (numA) {
   <  numB -> foo()
   == numB -> bar()
   >  numB -> baz()
}

val defaultInt = default(int)
to name a few. one of the distinct differences between the languages, though, is that c# does not have the type-erasure that the jvm does, so perhaps that allows for
default
e

E.Kisaragi

07/14/2020, 11:26 PM
you can omit expression of infix functions' first argument, if you gave when to a expression. by the way, comparing operators are not infix function; they'll be instituted with jvm-native comparing or Comparable.compreTo . also, you can slice list with list.slice(0..3)
2 Views