Re: TIB: Re:GetKey


[Prev][Next][Index][Thread]

Re: TIB: Re:GetKey




The way I see it you got 2 options and you probably won't like either
of them.

1-Put the code to move the character(or whatever else is after "Lbl
A") between the "Then" and the "Else". The problem with doing this is
that you might be writing exactly the same code in twelve different
places in your prog.

2-Use a subprogram. Make another program with the code that comes
after "Lbl A" in it and a return at the end. Then write: (I decided to
call the second program ZPROGB)

>:If sub(Str0,E-16,1) =/= " ":Then
prgmZPROGB
>:Else

The problem with this solution is that you end up with two programs
instead of one. If you do it 10 times, you end up with 11 programs. I
don't know about other people, but I HATE subrograms. The advantage is
that you can call that piece of code from anywhere in your program.

An Important note: Remeber that you can use _some_ goto statements to
break out of loops if it is really necessary, just make sure they
don't get called 50 times every time the prog is run!!

BTW: You don't have to use the else statement, you can just use
if/then/end (or just if to get the following line of code to execute.)

Your code would be:

>:If sub(Str0,E-16,1) =/= " ":Then
>:Goto A
End

or

>:If sub(Str0,E-16,1) =/= " "
>:Goto A

does the same thing, is faster and smaller

Philipp Keller


>Thanks.  I believe you are right.  The loop to tell if something is
in your
>way goes...
>
>:If sub(Str0,E-16,1) =/= " ":Then
>:Goto A
>:Else
>and then the stuff to do if there is a blank space.
>
>I have a lot of loops like this that execute every time a button is
pressed.
>That would explain why it starts to get frustratingly slow (although
it was
>already) and finally errs.  I thought the calculator dumped any
routine from
>the stack after exiting.
>
>Now, how do I fix this?  I'm using a TI-83.
>
>Tatsuo
>