Which of these would be correct?
if(dialog != null && dialog.isShowing){}
if(dialog.isShowing && dialog != null){}
if(dialog != null){
if(dialog.isShowing){}
}
The &&
operator is called a short circuit operator. This means once the result is known. i.e., false && x
is always false
it doesn't evaluate the remaining expressions.
A variation on this is using the ||
short circuit, OR operation, like:
if(text == null || text.isEmpty())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With