我一直使用双竖线||表示if (($a == $b) || ($a == $c)) { },而使用or表示do_this() or do_that();。
||
if (($a == $b) || ($a == $c)) { }
or
do_this() or do_that();
为什么不用if (($a == $b) or ($a == $c)) { }或者do_this() || do_that();呢?
if (($a == $b) or ($a == $c)) { }
do_this() || do_that();
使用这两个逻辑运算符是否有特定原因,还是只是个人偏好?
对于&&和and的选择也是一样,我只使用&&。
&&
and
用户名或邮箱地址
密码