TI Basic doesn’t allow real subroutines, but instead uses external programs. Here’s an example that draws 3 different colored lines in a continuous loop using an internal subroutine. Variables are passed to the subroutine using a list. S1(1) contains the return value, S1(2) contains the Y line position, and S1(3) contains the line color. I was wondering if this is an OK way to use internal subroutines or will it eventually cause problems if used in larger programs. I did a search for subroutines but didn’t find anything useful. Also, is there a better way of doing this.
PS. Something should probably be added to the end of the subroutine in case none of the if statements match.
Code:
PS. Something should probably be added to the end of the subroutine in case none of the if statements match.
Code:
Goto A
”DRAW LINE SUBROUTINE
Lbl DL
For(Z,1,260)
Pxl-On(ʟS1(2),Z,ʟS1(3))
End
If ʟS1(1)=1:Goto R1
If ʟS1(1)=2:Goto R2
If ʟS1(1)=3:Goto R3
”END SUBROUTINE
Lbl A
While 1
ClrDraw
{1,100,GREEN}→ʟS1
Goto DL
Lbl R1
{2,75,RED}→ʟS1
Goto DL
Lbl R2
{3,50,NAVY}→ʟS1
Goto DL
Lbl R3
End