© 2005 A.P. Lawrence
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
0
The "$x++" following the "||" will not be evaluated because "||" and its near equivalent "or" are "lazy" - they evaluate terms left to right, and as soon as a "true" condition is seen, the evaluation stops. So, because "$a" is already "1", that's as far as the evaluation gets, and $x does not get incremented. If $a were 0 or null, the increment would be done - but "foo" would never be printed, because $x was zero when that term was evaluated - the increment takes place after the "or" has made up its mind.
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Add your comments