KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Why there are four logical operators: &, && |, || What's the differences in usage? Yes, I've checked the docs, yet I'm a little bit confused. The docs says: ‘&’ and ‘&&’ indicate logical AND and ‘|’ and ‘||’ indicate logical OR. The shorter form performs elementwise comparisons in much the same way as arithmetic operators. The longer form evaluates left to right examining only the first element of each vector. Evaluation proceeds only until the result is determined. The longer form is appropriate for programming control-flow and typically preferred in ‘if’ clauses. I think a piece of example will clearly demonstrate them. Thanks.
Tags (comma-separated)
Save Edits
Cancel