This isn't about simply making the program not cra...
# announcements
r
This isn't about simply making the program not crash. It did EXACTLY what the programmer asked it to do - do something if, and only if, some value was not null. It's the programmers responsibility to think about what should happen if the value is null - the
?.
notation is just giving the programmer a tool to easily skip something if it's not available. That IS a null check, just in a condensed, easily readable form. There is also the
!!.
notation, which DOES make the program crash if the value is null, if that's what you want. Overall, the system just forces you to think about how to handle your nulls, instead of java, which just doesn't care, which is way worse. The system pushes you towards not using nullable values at all, and if you have to, gives you tools to easily deal with them. And you still haven't shown a single bit of code to show what you would like instead.
👍 2