3 ms·
The non-display of spaces in Firefox is disconcerting. CTRL-C doesn't work on the quintessential test of 10 print "Hello world" 20 goto 10 Doing that on one l
by bcrl 5y ago
The non-display of spaces in Firefox is disconcerting. CTRL-C doesn't work on the quintessential test of
10 print "Hello world"
20 goto 10
Doing that on one list as 10 print "Hello world" ; goto 10
doesn't work as the semicolon seems to be misinterpreted as part of the PRINT statement rather than separating multiple statements as most BASICs did. Edit: my memory was wrong - it should be :. It's been a while...
The END keyword seems to be missing.
Simple loops using IF don't seem to work, and I'm not sure why.
- carl_dr 5y agoI can't help with the IF without seeing what you're trying, but for your other points, press Escape to interrupt a running program, Semicolons are used as string concatenation but you can use colons to separate statements, and STOP is used to halt execution
- James-Livesey 5y agoThe spaces issue should now be fixed (see GH PR #7)! If you do a hard reload, it should be much easier to edit now. `if`/`end` _should_ work; try out this demo to see it in action: https://jamesl.me/atto/?code=10+num%3D0%0A20+if+num+mod+2%3D0%0A30+print+num%3B+%22+is+even%22%0A40+end%0A50+num%3Dnum%2B1%0A60+goto+20 https://jamesl.me/atto/?code=10+num%3D0%0A20+if+num+mod+2%3D... If you press Esc and then run `list`, you should be able to see the code behind this demo. More info about `if` and many other control flow statements are available under `help` > Command reference > Control flow commands. You can also do some one-liners, too: https://jamesl.me/atto/?code=10%20num%3D0%0A20%20if%20num%20mod%202%3D0%3Aprint%20num%3B%20%22%20is%20even%22%3Aend%0A30%20num%3Dnum%2B1%0A40%20goto%2020 https://jamesl.me/atto/?code=10%20num%3D0%0A20%20if%20num%20... Though not precisely the same as some of the original BASIC syntax, I've made adaptations so that `if` works on multiple lines (instead of having to make multiple `goto` statements), much like modern PLs.
- bcrl 5y agoThanks... The code I was trying was: 10 i = 0 20 print "i =", i 30 i = i + 1 40 if i < 20 then 20 I note that if I use i% to force it to be an integer, then it works. Quite a few BASIC implementation defaulted to floating point back in the '80s if the type wasn't explicitly specified. This has brought back some memories. =-) AmigaBASIC was rather nice as it had primitives for dealing with the creation of windows and dealing with mouse input events. That and QuickBASIC kept me occupied for many, many hours as a kid.