mzgreen
08/31/2016, 7:46 PMadambl4
08/31/2016, 7:54 PMsreich
08/31/2016, 7:58 PM@Transient
on a field and it says this annotation is not applicable to target 'member property with backing field'sreich
08/31/2016, 7:58 PMsreich
08/31/2016, 7:58 PMkevinmost
08/31/2016, 8:01 PM@field:Transient
would work?sreich
08/31/2016, 8:02 PMsreich
08/31/2016, 8:07 PMaromal.s
09/01/2016, 10:10 AMwhen(x) {
is String, is Int -> {
print("x is an integer or string")
}
else -> {
print("x is unknown")
}
}
please let me know if there is any alternative way of checking multiple instance type in a single “case” blockanokmik
09/01/2016, 10:15 AMwhen(x) {
String, Int -> {
print("x is an integer or string")
}
else -> {
print("x is unknown")
}
}
aromal.s
09/01/2016, 10:16 AManokmik
09/01/2016, 10:18 AMwhen (mode) {
ADD, VIEW -> return true
else -> throw IllegalArgumentException()
}
bamdmux
09/01/2016, 10:21 AMbamdmux
09/01/2016, 10:22 AManokmik
09/01/2016, 10:22 AMaromal.s
09/01/2016, 10:22 AMaromal.s
09/01/2016, 10:22 AMScreen Shot 2016-09-01 at 3.51.12 PM.png▾
anokmik
09/01/2016, 10:26 AMaromal.s
09/01/2016, 10:26 AMwhen(x) {
is String, is Int -> {
print("x is an integer or string")
}
else -> {
print("x is unknown")
}
}
bamdmux
09/01/2016, 10:27 AMval s: String
is not equal to the class. The is
operator returns true if the variable is an instance to that classbamdmux
09/01/2016, 10:27 AManokmik
09/01/2016, 10:28 AMbamdmux
09/01/2016, 10:29 AMaromal.s
09/01/2016, 10:30 AMbamdmux
09/01/2016, 10:32 AMbamdmux
09/01/2016, 10:33 AMbamdmux
09/01/2016, 10:33 AMghosalmartin
09/01/2016, 10:34 AMbamdmux
09/01/2016, 10:34 AMfun Any.test() = when (this) {
is Int, is Long -> println("Number $this")
is String -> println("String $this")
else -> println("Other")
}
bamdmux
09/01/2016, 10:36 AM