Well folks,
 
You have shown me a number of ways to skin the cat...on offense to the cat of 
course.
 
It's programming and you can solve the problem in a number of ways, all of 
which here are interesting and I have to tell you that I've learned something 
today.

>>> Chip Davis <[EMAIL PROTECTED]> 7/7/2008 4:26 PM >>>
I'm afraid we're gonna have to cite you for a flagrant violation of DeMorgan's 
Law, Howard.  ;-)

In fairness, your problem is not caused by unfamiliarity with formal logic, but 
mere lack of clarity.  If I might suggest an alternative so far overlooked:

   If \(Left(answer,1) = 'Y' | answer = 'YES') Then Do
     Say answer
     Say "The wrong response has been entered"
      <etc>

This is logically equivalent and has the advantage of placing the comparisons 
in 
positive terms.   Also, "Left(foo,1)" is equivalent to "Substr(foo,1,1)" and 
somewhat clearer as well.

However, you are still stuck with the counter-intuitive "IF NOT" condition.

So what's wrong with phrasing your question in the positive and taking the 
other 
leg of the If-Then-Else?

   If Left(answer,1) = 'Y' | answer = 'YES'
     Then Nop
     Else Do
       Say answer
       Say "The wrong response has been entered"
         <etc>

Does that not make the intent of the code much clearer?

-Chip-

On 7/7/08 16:23 Howard Rifkind said:
> This is confusing me.
>  
> The response to the variable 'answer' is a Y.
>  
> Yet this portion of the code isn't working.  Shouldn't the logic just 
> fall thru because the response was a Y.
>  
> IF SUBSTR(ANSWER,1,1) /= 'Y' | ANSWER /= 'YES' THEN  
>    DO                                                
>      SAY ANSWER                                      
>      SAY 'THE WRONG RESPONSE HAS BEEN ENTERED'       
>      SAY                                             
>      SAY 'PROCEDURE IS TERMINATING, PLEASE TRY AGAIN'
>      EXIT                                            
>    END                                               
>  
> Thanks

_____________
LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential
and may be privileged. It is intended for the addressee(s) only.
Access to this E-mail by anyone else is unauthorized.
If you are not an addressee, any disclosure or copying of the
contents of this E-mail or any action taken (or not taken) in
reliance on it is unauthorized and may be unlawful. If you are not an
addressee, please inform the sender immediately, then delete this
message and empty from your trash.

Reply via email to