Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Ask Reuben 76 - GOTO  (Read 1044 times)
Reuben B.
Four Js
Posts: 935


« on: June 17, 2021, 04:46:28 am »

If you are like me, then you have probably learnt from an early age that the use of the GOTO statement should be discouraged.  I certainly discovered that on my own in my early days on a ZX-81 that using GOSUB was preferable to using GOTO.  Then I get to university and discover that others have discovered that long before me.

You might not have realised it, but before we introduced TRY/CATCH, you could have implemented the equivalent using GOTO and LABEL. 

Whilst I don't think you should allow unlimited use of GOTO, it does have its place in a controlled manner.   One such place is in a MENU statement to trigger an action as you enter the MENU and save the user selecting it themselves.

To read more about GOTO, goto https://4js.com/ask-reuben/ig-76/ 

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines