Difference between revisions of "FOCAL"

From Computer History Wiki
Jump to: navigation, search
(Cover basic syntax)
(Always 'type' floating point)
 
Line 5: Line 5:
 
[[Conditional]] statements ('IF') include an [[expression]], and three lines numbers. If the expression's value is less than zero, the first statement is executed; if zero, the second; or if greater than zero, the third. The second and third lines numbers are optional. [[Loop]]s ('FOR') are also available.
 
[[Conditional]] statements ('IF') include an [[expression]], and three lines numbers. If the expression's value is less than zero, the first statement is executed; if zero, the second; or if greater than zero, the third. The second and third lines numbers are optional. [[Loop]]s ('FOR') are also available.
  
[[Variable]] names are one or two characters long, of which the first must be a letter (other than 'F'). Values are always floating point. [[Array]]s are available.
+
[[Variable]] names are one or two characters long, of which the first must be a letter (other than 'F'). All variables always have a [[type]] of floating point. [[Array]]s are available.
  
 
A [[subroutine package|library]] of trigonometric [[function]]s is standard.
 
A [[subroutine package|library]] of trigonometric [[function]]s is standard.

Latest revision as of 13:22, 12 May 2023

FOCAL was an early interpreted programming language, very similar to BASIC, produced by DEC for use on smaller computers such as the PDP-8.

The syntax of FOCAL is very similar to that of BASIC; every statement has a line number. Statements can be entered in any order, but they will be executed in numerical order. One difference is that BASIC line numbers are integers, but FOCAL line numbers are in two parts (looking rather like floating point numbers). This allows groups of lines to be treated as an entity, e.g. for subroutines.

Conditional statements ('IF') include an expression, and three lines numbers. If the expression's value is less than zero, the first statement is executed; if zero, the second; or if greater than zero, the third. The second and third lines numbers are optional. Loops ('FOR') are also available.

Variable names are one or two characters long, of which the first must be a letter (other than 'F'). All variables always have a type of floating point. Arrays are available.

A library of trigonometric functions is standard.

External links