Search code examples
texas-instrumentsti-basic

What is the fastest infinite loop in TI-84+ Basic?


Since there are technically 4 types of loops (for, while, repeat, and goto/lbl), which one is the fastest to use "infinitely"? Here is what I mean:

while 1
End

repeat 0
End

lbl 1
goTo 1

for(n, 1, [number large enough to function as practically infinite]
End

Which of these is the fastest, or is there an even faster one?


Solution

  • In terms of both size and speed, the repeat and while loops are the fastest.

    While 1 and Repeat 0 are both 2 bytes, while End is 1. In terms of space, they are both 4 bytes.

    In terms of speed, the same is true. Just try making a simple program that loops to infinity and time it.

    TL;DR: While 1: End and Repeat 0: End