3 ms·
The 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
by James-Livesey 5y ago
The 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.