本文介绍了&和有什么区别?和&&在MATLAB中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MATLAB中的&&&逻辑运算符有什么区别?

What is the difference between the & and && logical operators in MATLAB?

推荐答案

单个&符&是逻辑AND运算符.双与号&&还是使用短路行为的逻辑AND运算符.短路仅表示仅当第一个操作数(左侧)未完全确定结果时才评估第二个操作数(右侧)

The single ampersand & is the logical AND operator. The double ampersand && is again a logical AND operator that employs short-circuiting behaviour. Short-circuiting just means the second operand (right hand side) is evaluated only when the result is not fully determined by the first operand (left hand side)

A& B(评估A和B)

A & B (A and B are evaluated)

A&& B(仅当A为true时才评估B)

A && B (B is only evaluated if A is true)

这篇关于&和有什么区别?和&&在MATLAB中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 07:50