Hacker News new | ask | show | jobs
by Jtsummers 1419 days ago
TI-BASIC definitely had loops, though maybe not on the version you had? I had the TI-85/86 (which were mostly identical, the 85 was stolen by a student in the tutoring lab I volunteered in in high school). Looking up TI-83 manuals, they had for and while loops.
1 comments

I was on a TI-83, not a plus, and couldn't find them at all.

Always possible I was just an idiot. I remember having looked it up, but I was also a dumb high schooler at the time.

What at least the 85/86 series didn't permit (86 was almost identical to the 85) was direct recursion, which woulds fail immediately. I don't think I ever tried indirect recursion, which also would have failed. If I understand correctly, the problem was that there was no call stack (in the way every mainstream language does things anymore). So the return address location for a program was singular, if you made multiple (recursive, direct or indirect) calls into a program where it would return to was whatever the last call set the return address to. Like old school COBOL and FORTRAN where procedures were non-reentrant. Of course, I was in high school too and didn't know about the inner workings of computers like that. So I figured out how to use the list data structure on the calculator as a stack to create my own "recursive" programs either trampolining (A calls B repeatedly in a loop until the list-as-stack is emptied, indicating termination) or with loops (skip the call to B and keep it all in one program).

Limitations lead to creativity.

I had a TI-83+, not a TI-83, so I can't be sure but I suspect you're misremembering which feature was missing: The + did have while loops but didn't have functions, but calling another program worked like a function call with no parameters and no return value (and you could fake both by using the global variables).
`Ans` stored the value of the last expression, so you could use that as a “return value” of sorts.
Lol, unfortunately I think you just missed it. Software-wise, the TI-83 was nearly identical to the plus. I actually had a later revision of TI-83 that had an identical housing to the plus, but with differently tinted buttons.