develooper Front page | perl.perl6.language | Postings from July 2001

Re: if then else otherwise ...

Thread Previous | Thread Next
From:
raptor
Date:
July 29, 2001 10:07
Subject:
Re: if then else otherwise ...
Message ID:
003201c11840$0df750d0$0500a8c0@xxx
> This makes no sense. ?: tests a boolean value, which is either true or
false.
> There is no ternary state for a boolean value. True/False, Yes/No, On/Off,
> 1/0. Are you suggesting Yes/No/Maybe? Or are you redefining True and
False?

]- I'm not talking about boolean's... but mostly this can be result of some
expression...
The simplest example is <=> and cmp.... but it also can be some function
call that returns : -1, 0, 1
Let me give you one example (that was the reason for my thouights about
this ):

I have to build a SELECT query and there was three possible combinations to
insert one condition into WHERE part i.e.:

$whereCond =  $cond ? ' field > $x AND ' : '' : ' field < $x AND';
$Query = qq{ SELECT .... FROM ... WHERE $whereCond ...};

gotcha...short and clear...

> Doesn't matter. What you're asking has no counterpart in boolean logic,
and
> as such would make no sense in any computer language.

]- yes you are right about this... but in the real live we don't have
real-TRUE and real-FALSE .... let's not go further but i think that things
like semiTrue and semiFalse incorporated in some way into the language will
be very cool addition that no one have...:") .... i'm dreaming here ... &&&
... ||| .... :")

>You may have an idea,  but you are saying it wrong if you do.
]- sorry, you are may be right again.... :")

=====
iVAN
raptor@unacs.bg
=====


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About