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