Quick Start Guide: Difference between revisions
Jump to navigation
Jump to search
CarlGundel (talk | contribs) (Created page with "== Quick Start Guide == :Liberty BASIC has some unique features that are not in other versions of BASIC. This section will explain these features. === Branch Labels === Many BASIC languages support line numbers, and Liberty BASIC also lets you use them, but it is really intended that the programmer use named branch labels instead. Branch labels are letters surrounded by square brackets, for example: <nowiki>[exampleBranchLabel]</nowiki> So, instead of using line numb...") |
CarlGundel (talk | contribs) No edit summary |
||
| Line 5: | Line 5: | ||
Many BASIC languages support line numbers, and Liberty BASIC also lets you use them, but it is really intended that the programmer use named branch labels instead. | Many BASIC languages support line numbers, and Liberty BASIC also lets you use them, but it is really intended that the programmer use named branch labels instead. | ||
Branch labels are letters surrounded by square brackets, for example: <nowiki>[exampleBranchLabel]</nowiki> | Branch labels are letters and numbers surrounded by square brackets, for example: <nowiki>[exampleBranchLabel]</nowiki> or <nowiki>[letters123]</nowiki> | ||
So, instead of using line numbers like so: | So, instead of using line numbers like so: | ||
Revision as of 23:33, 30 December 2023
Quick Start Guide
- Liberty BASIC has some unique features that are not in other versions of BASIC. This section will explain these features.
Branch Labels
Many BASIC languages support line numbers, and Liberty BASIC also lets you use them, but it is really intended that the programmer use named branch labels instead.
Branch labels are letters and numbers surrounded by square brackets, for example: [exampleBranchLabel] or [letters123]
So, instead of using line numbers like so:
10 input "What is your name?"; yourName$ 20 print "Nice to meet you, "; yourName$ 30 input "Ask again (Y/N)"; yn$ 40 if yn$ = "Y" or yn$ = "y" then 10 50 print "Bye." 60 end
The simplest example of this without line numbers is:
[ask]
input "What is your name?"; yourName$
print "Nice to meet you, "; yourName$
input "Ask again (Y/N)"; yn$
if yn$ = "Y" or yn$ = "y" then [ask]
print "Bye."
end
Notice that we only need one branch label instead of a program written using the line numbered style which has a line number for each line of code.