Category:Palo Alto Tiny BASIC: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "{{language|Palo Alto Tiny BASIC |tags=tinybasic}} {{implementation|BASIC}} '''Palo Alto Tiny BASIC''' is one of the most popular of the many versions of Tiny BASIC. It was developed in 1975 by Li-Chen Wang. ==Features== Palo Alto Tiny BASIC has some features that distinguish it from other Tiny BASICs: * The <code>FOR</code>...<code>NEXT</code> loop. Like in Microsoft BASIC, the upper and lower bounds of the loop are set on loop entry, and did not change during...")
 
(→‎Features: RND; separating print items; setting widths of print items.)
 
(2 intermediate revisions by the same user not shown)
Line 12: Line 12:
* The statement <code>STOP</code> in addition to <code>END</code>.
* The statement <code>STOP</code> in addition to <code>END</code>.
* The use of <code>#</code> for not-equals in comparisons, as opposed to <code><></code>.
* The use of <code>#</code> for not-equals in comparisons, as opposed to <code><></code>.
* The ability to set more than one variable in a single <code>LET</code> command: <syntaxhighlight lang="basic">LET A=1,B=0,A=A+2</syntaxhighlight>The word <code>LET</code> in a <code>LET</code> command can be omitted.
* Lack of <code>THEN</code> in an <code>IF</code> command.
* Numeric results of compare operations: 1 (if true), 0 (if false). Thus, one can use them in arithmetic expression. Note: <syntaxhighlight lang="basic">LET A=B=0</syntaxhighlight> means "set <code>A</code> to the result of comparing <code>B</code> with 0".
* A prompt in an <code>INPUT</code> command. If the prompt is omitted, the default is a name of the variable. E.g. <syntaxhighlight lang="basic">INPUT "WHAT IS THE HEIGHT"H</syntaxhighlight> will print <code>WHAT IS THE HEIGHT:</code> and wait to read an expression from the input device.<syntaxhighlight lang="basic">INPUT H</syntaxhighlight> will print <code>H:</code> and so on.
* The function <code>RND(X)</code> that returns a random number between 1 and X (inclusive).
* Separating print items with <code>,</code> (comma).
* Setting widths of numeric print items. A number preceeded by <code>#</code> sets the width (6 by default) of following numeric print items. It does not count leading spaces. For example,
<syntaxhighlight lang="basic">
10 PRINT "X",#2,1,10,"X"
20 PRINT 1,#4,10,20,#2,30,40
</syntaxhighlight>
displays
<pre>
X 1 10X
1 10 20 30 40
</pre>


==Implementations==
==Implementations==
Line 22: Line 38:
==External links==
==External links==
* Wikipedia has [[wp:Tiny BASIC#Palo Alto Tiny BASIC|a section about Palo Alto Tiny BASIC]] in the [[wp:Tiny BASIC|Tiny BASIC]] entry.
* Wikipedia has [[wp:Tiny BASIC#Palo Alto Tiny BASIC|a section about Palo Alto Tiny BASIC]] in the [[wp:Tiny BASIC|Tiny BASIC]] entry.
* [http://www.devili.iki.fi/pub/IBM/PC/languages/ TINY BASIC, version 1.1 for Intel 8086] version of Palo Alto Tiny BASIC (exe, doc, and assembler source code included).
* [http://www.devili.iki.fi/pub/IBM/PC/languages/ TINY BASIC, version 1.1 for Intel 8086] version of Palo Alto Tiny BASIC (exe, doc, and assembler source code included). For unclear reasons, it does not allow <code>S</code> to be a name of variable.
* [https://tinybc.sourceforge.net/ Tiny BASIC for Curses] - a superset of Palo Alto Tiny BASIC, but with little differences in syntax.
* [http://www.bitsavers.org/pdf/interfaceAge/197612/092-108.pdf ''Dr. Wang's Palo Alto Tiny BASIC'' by Roger Rauskolb] (manual in PDF).

Latest revision as of 00:37, 10 July 2023

Language
Palo Alto Tiny BASIC
This programming language may be used to instruct a computer to perform a task.
Lang tag(s): tinybasic
See Also:


Listed below are all of the tasks on Rosetta Code which have been solved using Palo Alto Tiny BASIC.
Palo Alto Tiny BASIC is an implementation of BASIC. Other implementations of BASIC.

Palo Alto Tiny BASIC is one of the most popular of the many versions of Tiny BASIC. It was developed in 1975 by Li-Chen Wang.

Features

Palo Alto Tiny BASIC has some features that distinguish it from other Tiny BASICs:

  • The FOR...NEXT loop. Like in Microsoft BASIC, the upper and lower bounds of the loop are set on loop entry, and did not change during the loop, so if one of the bounds is based on a variable expression, changing the variable do not change the bound. The STEP modifier is optional.
  • The ability to place several statements on a single line. Palo Alto Tiny BASIC uses the semicolon ; to separate statements, rather than the colon : common in BASICs.
  • A single numeric one-dimensional array, with the variable name @.
  • The statement STOP in addition to END.
  • The use of # for not-equals in comparisons, as opposed to <>.
  • The ability to set more than one variable in a single LET command:
    LET A=1,B=0,A=A+2
    
    The word LET in a LET command can be omitted.
  • Lack of THEN in an IF command.
  • Numeric results of compare operations: 1 (if true), 0 (if false). Thus, one can use them in arithmetic expression. Note:
    LET A=B=0
    
    means "set A to the result of comparing B with 0".
  • A prompt in an INPUT command. If the prompt is omitted, the default is a name of the variable. E.g.
    INPUT "WHAT IS THE HEIGHT"H
    
    will print WHAT IS THE HEIGHT: and wait to read an expression from the input device.
    INPUT H
    
    will print H: and so on.
  • The function RND(X) that returns a random number between 1 and X (inclusive).
  • Separating print items with , (comma).
  • Setting widths of numeric print items. A number preceeded by # sets the width (6 by default) of following numeric print items. It does not count leading spaces. For example,
10 PRINT "X",#2,1,10,"X"
20 PRINT 1,#4,10,20,#2,30,40

displays

X  1 10X
      1   10   20 30 40

Implementations

Palo Alto Tiny BASIC was adapted for many implementations:

External links