条件简写、&&

当条件为 true 时,执行某些操作,我们可能会这样写:

if(condition){
    
    
    toto()
}

这种方式可以用 && 简写:

condition && toto()

&& 当前面的判断值屎真的时候,就执行后面,如果为假就不执行了

猜你喜欢

转载自blog.csdn.net/weixin_43131046/article/details/121497871