|
|
| Just another Perl shrine | |
| PerlMonks |
Re: Perl Idioms Explained - && and || "Short Circuit" operatorsby demerphq (Chancellor) |
| on Oct 22, 2003 at 18:10 UTC ( [id://301397]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
C-style? You split "C-style" and "short cicuit" into two sections. The whole point of refering to them as "C-Style" is because they are "short circuit". I believe the reason was that C is the most commonly known old school language that defines its logical operators to "short circuit". Turbo Pascal's logical operators were short circuit, but I dont know if this is part of the Pascal language definition, or just one of many Borland extensions. OTOH, Basic generally does not have short circuit operators (and thus presumably Fortran does not have them either). However I'd guess that most modern languages have operators which short circuit considering the convenience they offer. Without them you have to write this
as a nested if, like this
which is a source of perpetual frustration to me when I have to hack on VB code. (A chore that luckily I do very rarely these days.) Anyway, good meditation.
---
demerphq First they ignore you, then they laugh at you, then they fight you, then you win.
In Section
Meditations
|
|
||||||||||||||||||||||||