https://kotlinlang.org logo
Title
e

evan

12/08/2017, 10:20 PM
This piece of code does not compile:
val byteVal:Byte = 0
val isZero = byteVal == 0
You have to change it to this to make it compile (and run):
val byteVal:Byte = 0
val isZero = byteVal == 0.toByte()
This seems overly complicated to just compare a byte-value with a literal. Do we really have to call a method (
toByte()
) to do this? Is there a modifier (much like
L
for longs and
f
for floats) to make this simpler and less expensive?
i

ilya.gorbunov

12/09/2017, 12:46 AM