Jonathan Lennox
08/21/2023, 5:08 PMwith to a potentially null argument? I have code looking generally like
with(myObject.statistics) {
debug.addNumber(stat1)
debug.addNumber(stat2)
}
but the statistics can be null if myObject isn't in the right state.Jonathan Lennox
08/21/2023, 5:09 PMif (this != null) block inside the with but that feels clunky?ascii
08/21/2023, 5:15 PMrun?
myObject.statistics?.run {
debug.addNumber(stat1)
debug.addNumber(stat2)
}Jonathan Lennox
08/21/2023, 5:20 PM