Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Logical operators bugged? (*solved*)
I can't see why this doesn't work:

dim a as uByte

FUNCTION get (capitalise as byte) as uByte
    DIM lastK AS uByte AT 23560: REM LAST_K System VAR
    DO LOOP until lastK <> 0 : REM Wait for a keypress

    IF capitalise >0 AND lastK >= 97 AND lastK <= 122 THEN:
            LET lastK = lastK - 32
    END IF

    IF capitalise <0 AND lastK >=65 AND lastK <= 90 THEN:
        LET lastK=lastK + 32          
    END IF    
    RETURN lastK

let a=get(1)

print a,chr$(a)

Without fail this doesn't capitalise the key I pressed. get(-1) should only produce lower case (a-z), get(0) should produce what's pressed (a-Z) and get(1) should produce UPPER case (A-Z). It doesn't seem to be changing it. I've proved the IF works - I think the AND is failing.

I tried
IF ((capitalise >0 AND lastK >= 97) AND lastK <= 122) THEN:
in order to see if' it's something in the multiple AND options. Any one of the three conditions, without the AND seems to come out true.

Are logical functions misbehaving?

Messages In This Thread

Forum Jump:

Users browsing this thread: 1 Guest(s)