-1

Is there an EOF operator in Ti-83 Basic like in many other languages, such as C? I know that some programmes terminate when the "On" button is pressed (much like the EOF operator, Ctrl+D, in *nix), but I haven't been able to figure out how this operation is assigned.

As a very bad example, say I have

:Prompt Str0
:While Str0 ≠ "EOF"
:Disp "This code works!"
:Prompt Str0
:End

I want it to print "This code works!" and then prompt for Str0 until I enter a key combo ("On" button, I'm guessing) that terminates the file.

Now of course there are other ways of expressing the code above that do not rely on EOF. I'm just trying to give a simple example of what a scenario in which EOF might be useful.

RamenChef
  • 5,557
  • 11
  • 31
  • 43
Fred Barclay
  • 834
  • 1
  • 13
  • 24
  • 1
    I don't see why this is necessary. Since the On button immediately terminates the program (and also produces an `ERR: BREAK` error, so it's not very ideal), I don't see why you would need any of that EOF business to handle it. – user3932000 Jan 28 '16 at 05:48
  • @user3932000 I think you're right. 2nd + Quit also seems to terminate without any messy ERR: BREAK messages. ;) – Fred Barclay Jan 30 '16 at 16:57

1 Answers1

1

If you are looking for a way to get keypad input to end your program, there is no single function, but you can use getKey to write code to do it. Here is an example of how to make a program go until a certain key combination is entered, or the program is broken.

:Disp "This code works!"
:While getKey ≠ 21
:End
:While getKey ≠ 31
:End
:While getKey ≠ 45
:End
:Disp "Program ending"
:Stop

The above code displays "This code works!", then waits until 2nd, ALPHA, then CLEAR are pressed before displaying "Program ending" then quitting. If you are unfamiliar with the getKey function, I recommend this link. Good luck with your coding!

Scott Mikutsky
  • 746
  • 7
  • 21
  • Sorry this is so late (I haven't been around for a while) but this looks very helpful. Thanks! If all goes well, I'll accept it after testing. ;) – Fred Barclay Apr 11 '16 at 17:07
  • @Fred I hope everything meets your satisfaction. If you have any additional questions, you know where to ask! – Scott Mikutsky Apr 12 '16 at 01:30