News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Bitwise "or" operation not working

Started by darkx, January 19, 2009, 06:11:06 PM

Previous topic - Next topic

darkx

When using the "or" command it doesn't seem to work right

PlayBASIC Code: [Select]
i=1
Do
If i=1 Or i=2 And k=1
Print "hi"
EndIf
Sync
Cls 0
Loop


shouldn't this print "hi"? currently I'm using playbasic 1.64h

kevin

#1
 No, the expression is only true when K ='s 1 

darkx

Oh I see...then how can I make it so if "i" equals "1" by itself it'll print "HI" while if "i" equals "2" "k" needs to equal "1" in order to print "HI"

I hope that made sense...

kevin

#3
PlayBASIC Code: [Select]
i=2
k=1
Do
Cls 0

If i=1 Or (i=2 And k=1)
Print "hi"
EndIf
Sync
Loop