Category:Palo Alto Tiny BASIC

From Rosetta Code
Revision as of 00:37, 10 July 2023 by imported>Christophoro S (→‎Features: RND; separating print items; setting widths of print items.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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