Larry Hiscock wrote: > If the use of GOTO is not proper in UniBasic, why does > the language include the verb?
- Because all BASICs derive from Dartmouth BASIC so it was in there from the start and a lot of old code depends on it. - Because all BASIC programmers know about it and _may_ want to use it. "Proper" is subjective. Rather than completely re-writing client code to my sense of what nice code looks like it's occasionally much easier to GOTO to get out of a jam that someone else created. - Because in the internal bowels of the BASIC compiler and runtime we find that all GOSUBs are actually GOTOs with a little extra code. The only difference is that on a GOSUB you push the address of the next instruction onto a stack before the jump. On RETURN the return stack is read, then popped, and the value of the address read is used for the next instruction - essentially another GOTO back to the original address+1. So it's not that GOTO is "included" - it's there no matter what, and the functionality is just exposed through a statement in the BNF. (The BNF is the table of valid statements.) - Because almost all languages have some form of GOTO and we'd see as many "why isn't there a GOTO" here if it wasn't in UniBasic. And for those of you who remembers the "why" verb: --Because Tyler Says So.-- Inside joke for some of you. :) Tony ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
