View Full Version : Can I use goto statements in tb?
peralta_mike
03-03-2011, 04:17
Can I use goto statements in thinbasic?
I may need this to port over some rmb rocky mountain basic programs.
- mike peralta
danbaron
03-03-2011, 07:28
Unless something has changed, I think the answer is, "no".
:oops:
Sorry.
Dan
ErosOlmi
03-03-2011, 09:16
Hi Mike, Dan is correct: thinBasic does not support (by precise choice) GOTO and GOSUB.
GOSUB is an old construct that can be easily substituted by SUBs and/or FUNCTIONs.
Regarding GOTO: I know it is an easy exit strategy for many situations but by design I didn't want to see any "spaghetti code" written with thinBasic. thinBasic has many flow control statements and some exit strategy too.
Sorry but this will not change
Eros
Petr Schreiber
03-03-2011, 09:21
Hi,
if you need some info on porting code from elder forms of BASIC, you might read "Legacy BASIC code and ThinBasic" article in the first issue of ThinBASIC Journal (http://www.thinbasic.com/community/showthread.php?9026-ThinBasic-Journal-Issue-1).
Petr
peralta_mike
03-03-2011, 17:42
Thanks for the quick answer.
I believe I can port old RMB basic with goto's by using switch/case statements.
It's a good idea to upgrade some portions of old code anyway
for future maintainability.