Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.sys.cbm    |    Discussion about Commodore micros    |    53,866 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 52,222 of 53,866    |
|    Janne Johansson to All    |
|    Something strange going on.    |
|    13 Apr 18 09:53:58    |
      From: nospam.Janne.Johansson@f6.n221.z2.binkp.net              On 2018-04-11 02:33, Shaun Bebbington : All wrote:       > Hi,       >       > I found something odd today in the powerful CBM BASIC v2.0.       >       > Having worked with Sinclair BASIC quite a lot recently, I use GOTO X       > where X is a valid line number (i.e., LET X = 100). But I know that's       > not possible with Microsoft BASIC. Of course there is the ON X GO TO       > 100,200 ...       >       > So I thought "I know, I'll try and use a function, could CBM BASIC use       > this as a look up table". The following, I expected to go to the value       > in the function A() which returns 10, but...       >       > 0 DEF FN A(X) = 10       > 1 PRINT FN A(0)       > 2 GO TO FN A(0)       > 3 PRINT "END GRACEFULLY"       > 4 END       > 10 PRINT "STOP"       > 11 STOP       >       > Try it for yourself. What's going on here?              BTW, I got reminded of someone devising a way to make selfmodifying       BASIC on C64, by printing out the line you wanted to have, then moving       the cursor to that line on the screen, adding "RETURN" and R, U, N and       "RETURN" into the keyboard input buffer and telling the system the       buffer has 5 CHARS in it, then ending the program, whereupon the system       will enter that line you generated and then re-ran your program.              Of course you have to write it so it can restart nicely on the second       and upcoming runs, but with such a scheme, you could make a       10 GOTO |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca