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-PLUS
(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!
===Variables, expressions and matrixes=== Variable names in the early versions of BASIC-PLUS could be a single letter or a single letter followed by a single digit.{{sfn|PLUS|1972|p=2-6}} With the inclusion of "Extend mode" in later versions, variable names could be up to 29 characters long, and dot (.) was added as a permitted character. Every variable name still had to begin with a letter.{{efn|Before the introduction of Extend mode, white space was not required between variables and other language elements: {{code|1=FOR I=STOP}} would be interpreted as {{code|1=FOR I = S TO P|2=basic}}.}} As in most versions of BASIC, the {{code|LET}} keyword, for variable assignment, was optional. It could set multiple variables to a single value, like {{code|1 = LET A,B,C=10|2=basic}}.{{sfn|PLUS|1972|p=3-3}} The language supported three data types; floating-point numbers, integers, and strings. Variables with no suffix were floating point (8 bytes, range 0.29{{x10^|-38}} to 1.7{{x10^|38}}, up to 16 digits of precision). Integer variables (16-bit, range −32768 to +32767) were indicated with a {{code|%}} suffix,{{sfn|PLUS|1972|p=6-1, 6-2}} string variables (variable length) were indicated with a {{code|$}} suffix.{{sfn|PLUS|1972|p=5-2}} The list of mathematical and logical operators was typical of most BASICs, with some extensions. For math, {{code|+}}, {{code|-}}, {{code|*}}, {{code|/}} and {{code|^}} were supported, along with {{code|**}} as an alternate form of {{code|^}} for [[computer terminal]]s that might not have that character. Standard logical comparisons were {{code|{{=}}}}, {{code|<}}, {{code|>}}, {{code|<{{=}}}}, {{code|>{{=}}}}, and {{code|<>}}. One interesting addition was the {{code|{{=}}{{=}}}} operator, for "approximately equal". This would return true if the two numbers would be printed the same, that is, their six most significant digits were the same.{{sfn|PLUS|1972|p=2-9}} Logical operators included the typical {{code|NOT A}}, {{code|A AND B}} and {{code|A OR B}}, along with {{code|A XOR B}}, {{code|A EQV B}} which return true if both A and B are true or both are false, and {{code|A IMP B}} which is false if A is true and B is false and otherwise always true.{{sfn|PLUS|1972|p=2-10}} The {{code|DIM}} statement could allocate one-dimensional and two-dimensional arrays of any of the three data types. The range of subscripts always began with 0 (but {{code|MAT}} statements did not set elements in row 0 or column 0).{{sfn|PLUS|1972|p=3-21}}{{sfn|PLUS|1972|p=5-3}} The language also included a number of {{code|MAT}} commands to work with the entire array (or MATrix). The {{code|MAT READ}} command would fill the matrix with values in a {{code|DATA}} statement,{{sfn|PLUS|1972|p=7-2}} {{code|MAT INPUT}} would fill the array with user-typed values, and {{code|MAT PRINT}} would print out the elements in a 1D or 2D format.{{sfn|PLUS|1972|p=7-3}} {{code|MAT}} could also be used to set default values in a matrix using associated keywords, for instance, {{code|1 = MAT A=ZER}} would fill the A array with zeros.{{sfn|PLUS|1972|p=7-5}} {{code|TRN}} would transpose an entire matrix, and {{code|INV}} would invert it.{{sfn|PLUS|1972|p=7-7}} Additionally, {{code|+}}, {{code|-}}, and {{code|*}} could be used on matrixes, performing the associated matrix operation.{{sfn|PLUS|1972|p=A-1}}
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)