其他分享
首页 > 其他分享> > 短路逻辑short-circuit logic

短路逻辑short-circuit logic

作者:互联网

逻辑操作符有个有趣的特性:在不需要求值的时候不进行操作。举个例子,表达式 x and y,需要 x 和 y 两个变量同时为真(True)的时候,结果才为真。因此,如果当 x 变量得知是假(False)的时候,表达式就会立刻返回 False,而不用去管 y 变量的值。

标签:逻辑,short,False,变量,circuit,logic,求值,时候,表达式
来源: https://blog.csdn.net/dragon_18/article/details/122093795