From: bogax on
On Jan 20, 7:37 pm, Adric22 <adric5...(a)gmail.com> wrote:
> > 10 GET A$: IF A$="" THEN 10
> > 20 IF A$=CHR$(133) THEN X=1-X
> > 30 IF A$=CHR$(134) THEN Y=1-Y
> > 40 PRINT X,Y
> > 50 GOTO 10
>
> You know, I wasn't looking for or needing any code like that, I was
> just casually reading through.  But lines 20 and 30 are brilliant!  I
> would have never thought of such a simple mechanism.  I can't tell you
> how many times I could have used something like that in my code but
> instead I always wind up writing two conditional statements, something
> to the effect of:
>
> IF X=0 THEN X=1
> IF X=1 THEN X=0
>
> Anyway, your method is much more efficient and I'm pretty sure the
> same concept would work in assembly language as well using the SBC
> command.

I like that too.
Here's an alternative formulation (just playing)

10 GET A$: IF A$="" THEN 10
20 X=ABS((A$="X")+X)
30 Y=ABS((A$="Y")+Y)
40 PRINT X,Y
50 GOTO 10