Re: TRUE

Abigail <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
On Wed, Jan 21, 2004 at 06:43:26PM +0200, Gaal Yahas wrote:
> On Wed, Jan 21, 2004 at 11:09:29AM -0500, Andrew Pimlott wrote:
> > I like to use symbolic constants.  Wha can remember what all those
> > 1, 0, undef, and ''s mean anyway?  So I start off all my programs
> > with
> > 
> >     use constant FALSE => !TRUE;
> >     use constant TRUE => !FALSE;
> 
> I start off all my programs with use strict :-)
> 
> But more to the point, how do you use your TRUE and FALSE? Suppose you
> want to test the return value of this sub:
> 
> sub returns_a_true_value { 8.2 }
> 
> Would you do "if (returns_a_true_value() eq TRUE)"? "== TRUE"?
> Neither would work, and you can just do "if (returns_a_true_value())"
> directly anyway.


Not a problem for the Fun With Perl mailinglist, is it?

    if (returns_a_true_value () xor FALSE) {
        print "It returned true.\n";
    }


Abigail
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.