Hi I have little question about elvis operator li...
# announcements
n
Hi I have little question about elvis operator list.forEach { nInt? >n? print("No number is available") } I want to pass print statement on left hand side any suggestion or solution appreciated
t
Copy code
when(n){
	null-> println("n is null")
	else-> ...
}
or use
Copy code
if(n==null) ... else ...
if you want write it in a line.
also kotlin 1.3 allows
Copy code
when(val cursor=query(...)){
	null-> log.d("cursor is null")
	else-> cursor.use{ cursor-> ... }
}
n
thanks for your reply so it means we can only perform operation on left hand side in elvis operator