<> is not the same as !. <> means not equal, ! is the operator for a logical or bitwise NOT. The second example of code you posted compiles without any errors, but the assembly that is generated does not do anything useful.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This code:
myvar = 10
if (myvar <> 7) & (myvar <> 8) then
myvar = 0
end if
Compiles to:
movlw 10
movwf MYVAR
movf MYVAR,W
movwf SysCalcTempA
movlw 7
movwf SysCalcTempB
call SysCompNotEqual
movf SysCalcTempX,W
movwf SysTemp1
movf MYVAR,W
movwf SysCalcTempA
movf ,W
movwf SysCalcTempB
call SysCompLessThan
movf SysCalcTempX,W
movwf SysTemp2
movf SysTemp2,W
movwf SysCalcTempA
movlw 8
movwf SysCalcTempB
call SysCompMoreThan
movf SysCalcTempX,W
movwf SysTemp3
movf SysTemp1,W
andwf SysTemp3,W
movwf SysIFTemp
btfss STATUS, Z
clrf MYVAR
BASPROGRAMEND
sleep
goto $
Which is wrong and fails on assembling.
On the other hand this code compiles and assembles without error:
myvar = 10
if (myvar ! 7) | (myvar ! 8) then
myvar = 0
end if
But I'm not sure if <> is the same thing as !
Fixed, http://gcbasic.sourceforge.net/newfiles/update.zip
<> is not the same as !. <> means not equal, ! is the operator for a logical or bitwise NOT. The second example of code you posted compiles without any errors, but the assembly that is generated does not do anything useful.