Top "Short-circuiting" questions

A feature of some languages to skip certain code at runtime that doesn't affect the outcome, especially when testing compound conditions

Haskell prime test

I'm new to Haskell, and I'm trying a bit: isPrime :: Integer->Bool isPrime x = ([] == [y | y<-[2..floor (…

haskell primes short-circuiting
Java short circuit evaluation

I thought Java had short circuit evaluation, yet this line is still throwing a null pointer exception: if( (perfectAgent != null) &…

java logical-operators short-circuiting
Why would a language NOT use Short-circuit evaluation?

Why would a language NOT use Short-circuit evaluation? Are there any benefits of not using it? I see that it …

language-agnostic conditional short-circuiting
VBA Short-Circuit `And` Alternatives

VBA doesn't short-circuit VBA does not support short-circuiting - apparently because it only has bitwise And/Or/Not etc operations. …

vba short-circuiting
Short circuiting statement evaluation -- is this guaranteed? [C#]

Quick question here about short-circuiting statements in C#. With an if statement like this: if (MyObject.MyArray.Count == 0 || MyObject.MyArray[0].…

c# conditional-operator logical-operators short-circuiting
Using &&'s short-circuiting as an if statement?

I saw this line in the jQuery.form.js source code: g && $.event.trigger("ajaxComplete", [xhr, s]); My …

javascript short-circuiting
When to prefer `and` over `andalso` in guard tests

I am curious why the comma ‹,› is a shortcut for and and not andalso in guard tests. Since I'd call …

erlang short-circuiting boolean-expression
Does Java check all arguments in "&&" (and) operator even if one of them is false?

I have such code: if(object != null && object.field != null){ object.field = "foo"; } Assume that object is null. …

java logical-operators short-circuiting and-operator
How to avoid short-circuit evaluation on

I'm working with Ruby on Rails and would like to validate two different models : if (model1.valid? && model2.…

ruby-on-rails operators logical-operators short-circuiting
Why does Python return [15] for [0xfor x in (1, 2, 3)]?

When running the following line: >>> [0xfor x in (1, 2, 3)] I expected Python to return an error. Instead, the …

python python-3.x operator-precedence short-circuiting