SuperBASIC: Difference between revisions
From F256 Foenix
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
* [[SuperBASIC Memory Map]] | * [[SuperBASIC Memory Map]] | ||
* Watch EMWhite's excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist]. | * Watch EMWhite's excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist]. | ||
An informal list of tips, "gotchas": | |||
==== An informal list of tips, "gotchas": ==== | |||
===== Ernestos' tips on if, then, else: ===== | |||
# A regular <code>if then</code> condition can't contain an <code>else</code> statement, as in this example: | # A regular <code>if then</code> condition can't contain an <code>else</code> statement, as in this example: | ||
<code>10 if a=0 then x=10</code> | <code>10 if a=0 then x=10</code> | ||
# If you need to do an <code>if then else</code> structure, you actually have to do an <code>if else endif</code> structure like in the following example, skipping the <code>then</code> statement. | # If you need to do an <code>if then else</code> structure, you actually have to do an <code>if else endif</code> structure like in the following example, skipping the <code>then</code> statement. | ||
<code>10 if a=0 | <code>10 if a=0<br /> | ||
20 x=1 | 20 x=1<br /> | ||
30 else | 30 else<br /> | ||
40 x=2 | 40 x=2<br /> | ||
50 endif</code> | 50 endif</code> | ||
# If you do it in one line it needs to have some colons added, making it look weird like this: | # If you do it in one line it needs to have some colons added, making it look weird like this: | ||
Line 17: | Line 20: | ||
<code>10 if a=0:x=1:else:x=2: REM "<-- Error, omited the endif"</code> | <code>10 if a=0:x=1:else:x=2: REM "<-- Error, omited the endif"</code> | ||
# be careful not to add an extra <code>then</code> statement by mistake to an <code>if else endif</code> structure, if you do -All hell breaks loose again!!- | # be careful not to add an extra <code>then</code> statement by mistake to an <code>if else endif</code> structure, if you do -All hell breaks loose again!!- | ||
<code>10 if a=0 then : rem "<-- Error, THEN is not needed!!!" | <code>10 if a=0 then : rem "<-- Error, THEN is not needed!!!" <br /> | ||
20 x=1 | 20 x=1 <br /> | ||
30 else | 30 else <br /> | ||
40 x=2 50 endif</code> | 40 x=2 50 endif</code> |
Revision as of 07:03, 15 March 2024
SuperBASIC is inspired by BBC BASIC but offers quite a bit more.
- SuperBASIC Reference Manual.
- SuperBASIC Memory Map
- Watch EMWhite's excellent intro series on YouTube: Full Playlist.
An informal list of tips, "gotchas":
Ernestos' tips on if, then, else:
- A regular
if then
condition can't contain anelse
statement, as in this example:
10 if a=0 then x=10
- If you need to do an
if then else
structure, you actually have to do anif else endif
structure like in the following example, skipping thethen
statement.
10 if a=0
20 x=1
30 else
40 x=2
50 endif
- If you do it in one line it needs to have some colons added, making it look weird like this:
10 if a=0:x=1:else:x=2:endif
- if you dare to omit the
endif
thinking that theif
statement won't need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!-
10 if a=0:x=1:else:x=2: REM "<-- Error, omited the endif"
- be careful not to add an extra
then
statement by mistake to anif else endif
structure, if you do -All hell breaks loose again!!-
10 if a=0 then : rem "<-- Error, THEN is not needed!!!"
20 x=1
30 else
40 x=2 50 endif