The answer depends on the exact language used.
In some weakly typed languages (eg, Perl, JavaScript) a && bwill be assessed by the actual value b, if both aand bare "true" or aotherwise.
In C and C ++, the operator &&will simply return 0 or 1, i.e. equivalent int trueor false.
In Java and C #, it is not even legal to deliver intto &&- operands should already be logical.
I don’t know any language from the top of my head, where a && b == a & bfor all the valid values of aand b.
source
share