SuperBASIC: Difference between revisions

From F256 Foenix
Jump to navigationJump to search
No edit summary
No edit summary
Line 23: Line 23:
20    x=1 <br />
20    x=1 <br />
30    else <br />
30    else <br />
40    x=2 50 endif</code>
40    x=2 <br />
50 endif</code>

Revision as of 08:04, 15 March 2024

SuperBASIC is inspired by BBC BASIC but offers quite a bit more.

An informal list of tips, "gotchas":

Ernestos' tips on if, then, else:
  1. A regular if then condition can't contain an else statement, as in this example:

10 if a=0 then x=10

  1. If you need to do an if then else structure, you actually have to do an if else endif structure like in the following example, skipping the then statement.

10 if a=0
20 x=1
30 else
40 x=2
50 endif

  1. 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

  1. if you dare to omit the endif thinking that the if 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"

  1. be careful not to add an extra then statement by mistake to an if 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