Part of the reason is that the NULL may mean the value is not known. If you ask whether my middle name is the same as yours but you don't know mine, your approach would say they are different. They may well be the same.
The handling of the situation must depend on the circumstances. Sometimes it is necessary to first ensure that both values exist before testing for equality. Ask yourself, did Abraham Lincoln and Harry Truman have the same middle name? Bill Cook Kent WA USA ----- Original Message ----- From: "William Carson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 28, 2002 8:00 AM Subject: RE: Not Equal > I have question in regards to IF-THEN comparisons. > In this situation: > vA INT=5 > vB INT=NULL > Why doesn't R:Base (and some other programming languages) know that they > are not equal? Why do you need an IF vB IS NULL THEN when IF vA <> vB > THEN should suffice? > > Bill > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > On Behalf Of MikeB > Sent: Monday, January 28, 2002 10:20 AM > To: [EMAIL PROTECTED] > Subject: Re: Not Equal > > VB IIF: > > IIf(expr, truepart, falsepart) > > The IIf function syntax has these named arguments: > > Part Description > ________________________________________________ > expr Required. Expression you want to evaluate. > truepart Required. Value or expression returned if expr is > True. > falsepart Required. Value or expression returned if expr is > False. > > > Remarks > > IIf always evaluates both truepart and falsepart, even though it returns > only one of them. Because of this, you should watch for undesirable side > effects. For example, if evaluating falsepart results in a division by > zero > error, an error occurs even if expr is True. > > > > FoxPro IIF: > > IIF(lExpression, eExpression1, eExpression2) > > Return Values > Character, Numeric, Currency, Date, or DateTime > > Parameters > lExpression Specifies the logical expression that IIF( ) > evaluates. > eExpression1, eExpression2 > If lExpression evaluates to true (.T.), eExpression1 is returned. If > lExpression evaluates to false (.F.), eExpression2 is returned. > > This function, also known as Immediate IF, evaluates a logical > expression > and then returns one of two expressions. If the logical expression > evaluates > to true (.T.), IIF( ) returns the first expression. If the logical > expression evaluates to false (.F.), IIF( ) returns the second > expression. > > > > > > ----- Original Message ----- > From: "Lawrence Lustig" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, January 27, 2002 9:06 PM > Subject: Re: Not Equal > > > > > In addition to "IFNE", why not add "IFGE" (IF >=) and "IFLE" > > > (IF <=). This would give a full complement of boolean operators. > > > > How about a generalized immediate IF function: > > > > IIF(BooleanExpression, TrueValue, FalseValue) > > > > which would evaluate the BooleanExpression and return the TrueValue or > > FalseValue depending on the result. The BooleanExpression could be > anything > > that follows an IF in the R:Base language: > > > > vConfirmMsg = + > > IIF(PayType IN ('Visa', 'MC', 'Amex'), 'Needs Confirmation', > 'Payment > OK') > > > > This would have all the functionality of IFEQ, IFGT, etc, plus a lot > more > > that is not currently available in the variable list in Forms and > Reports. > > > > (IIF happens to be the name of this function in, I think, FoxPro, but > the > > name could be anything else). > > -- > > Larry Lustig > > > > > > _________________________________________________________ > > Do You Yahoo!? > > Get your free @yahoo.com address at http://mail.yahoo.com > > > > ================================================ > > TO SEE MESSAGE POSTING GUIDELINES: > > Send a plain text email to [EMAIL PROTECTED] > > In the message body, put just two words: INTRO rbase-l > > ================================================ > > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] > > In the message body, put just two words: UNSUBSCRIBE rbase-l > > ================================================ > > TO SEARCH ARCHIVES: > > http://www.mail-archive.com/rbase-l%40sonetmail.com/ > > > ================================================ > TO SEE MESSAGE POSTING GUIDELINES: > Send a plain text email to [EMAIL PROTECTED] > In the message body, put just two words: INTRO rbase-l > ================================================ > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] > In the message body, put just two words: UNSUBSCRIBE rbase-l > ================================================ > TO SEARCH ARCHIVES: > http://www.mail-archive.com/rbase-l%40sonetmail.com/ > > ================================================ > TO SEE MESSAGE POSTING GUIDELINES: > Send a plain text email to [EMAIL PROTECTED] > In the message body, put just two words: INTRO rbase-l > ================================================ > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] > In the message body, put just two words: UNSUBSCRIBE rbase-l > ================================================ > TO SEARCH ARCHIVES: > http://www.mail-archive.com/rbase-l%40sonetmail.com/ ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/
