Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
BASIC
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Structured BASIC ==== Second-generation BASICs (for example, [[VSI BASIC for OpenVMS|VAX Basic]], [[SuperBASIC]], [[True BASIC]], [[QuickBASIC]], [[BBC BASIC]], [[Pick operating system|Pick BASIC]], [[PowerBASIC]], [[Liberty BASIC]], [[QB64]] and (arguably) [[COMAL]]) introduced a number of features into the language, primarily related to structured and procedure-oriented programming. Usually, [[line number]]ing is omitted from the language and replaced with [[label (computer science)|labels]] (for [[GOTO]]) and [[subroutine|procedures]] to encourage easier and more flexible design.<ref name="GBvsQB">{{cite web|url=http://support.microsoft.com/kb/73084|title=Differences Between GW-BASIC and QBasic|date=2003-05-12|access-date=2008-06-28|archive-url=https://web.archive.org/web/20131019181140/http://support.microsoft.com/kb/73084|archive-date=2013-10-19}}</ref> In addition keywords and structures to support repetition, selection and procedures with local variables were introduced. The following example is in Microsoft QuickBASIC: <syntaxhighlight lang="QBasic"> REM QuickBASIC example REM Forward declaration - allows the main code to call a REM subroutine that is defined later in the source code DECLARE SUB PrintSomeStars (StarCount!) REM Main program follows INPUT "What is your name: ", UserName$ PRINT "Hello "; UserName$ DO INPUT "How many stars do you want: ", NumStars CALL PrintSomeStars(NumStars) DO INPUT "Do you want more stars? ", Answer$ LOOP UNTIL Answer$ <> "" Answer$ = LEFT$(Answer$, 1) LOOP WHILE UCASE$(Answer$) = "Y" PRINT "Goodbye "; UserName$ END REM subroutine definition SUB PrintSomeStars (StarCount) REM This procedure uses a local variable called Stars$ Stars$ = STRING$(StarCount, "*") PRINT Stars$ END SUB </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)