TwoClocks
08/14/2020, 9:18 PMstreetsofboston
08/14/2020, 9:19 PMTwoClocks
08/14/2020, 9:20 PMstreetsofboston
08/14/2020, 9:20 PMenum class MyEnum(var value: Int) {
VALUE_ONE(1),
VALUE_TWO(2)
}
TwoClocks
08/14/2020, 9:20 PMTwoClocks
08/14/2020, 9:21 PMstreetsofboston
08/14/2020, 9:21 PMVALUE_ONE.value = 4
I don’t recommend this type of coding, but it is possible 🙂streetsofboston
08/14/2020, 9:22 PMval
properties are fine.TwoClocks
08/14/2020, 9:22 PMstreetsofboston
08/14/2020, 9:22 PMstreetsofboston
08/14/2020, 9:23 PMTwoClocks
08/14/2020, 9:23 PMstreetsofboston
08/14/2020, 9:23 PMstreetsofboston
08/14/2020, 9:24 PMstreetsofboston
08/14/2020, 9:24 PMTwoClocks
08/14/2020, 9:25 PMTwoClocks
08/14/2020, 9:25 PMstreetsofboston
08/14/2020, 9:28 PMString?
, which is String
or null
.
Best approximation is either-types. E.g
sealed class Either<out A, out B> {
data class Left<out A>(val left: A): Either<A, Nothing>()
data class Right<out B>(val right: B): Either<Nothing, B>()
}
streetsofboston
08/14/2020, 9:28 PMTwoClocks
08/14/2020, 9:29 PMNir
08/14/2020, 9:42 PMNir
08/14/2020, 9:42 PMNir
08/14/2020, 9:43 PMstreetsofboston
08/14/2020, 9:43 PMNir
08/14/2020, 9:43 PMNir
08/14/2020, 9:43 PMNir
08/14/2020, 9:44 PMNir
08/14/2020, 9:44 PMNir
08/14/2020, 9:44 PMNir
08/14/2020, 9:45 PMstreetsofboston
08/14/2020, 9:48 PMNir
08/14/2020, 9:57 PMNir
08/14/2020, 9:57 PMNir
08/14/2020, 9:58 PMNir
08/14/2020, 9:58 PMstreetsofboston
08/14/2020, 10:02 PMtypeOf(List<Int>) != typeOf(List<String>)
).TwoClocks
08/14/2020, 10:03 PMTwoClocks
08/14/2020, 10:03 PMNir
08/14/2020, 10:09 PMNir
08/14/2020, 10:09 PMNir
08/14/2020, 10:10 PMNir
08/14/2020, 10:10 PMTwoClocks
08/14/2020, 10:12 PMTwoClocks
08/14/2020, 10:13 PMNir
08/15/2020, 2:27 AMJavier
08/15/2020, 11:05 AM