yes, it has been a while.
it probably is a matter of wording. as has been pointed out by the other posters, and as i'm sure you're already aware, the logical operators and, or, xor, not are bitwise. they are also boolean. so the statement "when a boolean expression is used as a value, assigned to a variable or output in any way, QB will convert the result, after evaluation, to TRUE (-1) or FALSE (0)" is not correct.
print 5 or 3
5 or 3 is a boolean expression, and it is evaluated to 7.
it is relational operators, which are also boolean, but are not bitwise logical operators, that always evaluate to 0 or -1.
i doubt that you were unaware of this, so i believe the issue here was just a terminology issue.
I am reluctant to write too much on this subject here, because the posters here before me pretty much covered everything. (i had seen this thread on my mobile phone before there were any proper responses, but it was impossible to post a sufficient reply from my phone.) i will say this though: i believe it is possible to over complicate this subject. it is really quite simple, as long as you pay attention to what you are doing. i personally dislike the idea of declaring constants true = -1 and false = 0 and then using them in the program. for one thing, the programmer should already know what is true and what is false, and shouldn't need to rely on those constants. also, it seems that it could introduce confusion if anything other than 0 or -1 is encountered. qbasic does not have a boolean data type, nor does it need one.
Return to Index
|Response Title||Author and Date|
|Re: rule #3 more||Moneo on Oct 29|
|Constants add meaning to numbers.||on Oct 29|