Sample Session With Focal On A PDP15
FOCAL15 V6B *01.10 ASK "IN WHAT YEAR WERE YOU BORN?", YEAR *01.20 SET YEAROFFOCAL=YEAR-1969+1 *01.30 IF (YEAROFFOCAL) 02.10,02.10,01.40 *01.40 TYPE "YOU WERE BORN IN THE YEAR ",YEAROFFOCAL," OF FOCAL!",! *01.50 GOTO 01.10 *02.10 TYPE "YOU ARE TOO OLD FOR FOCAL, POPS",! *02.20 GOTO 01.10 *GO IN WHAT YEAR WERE YOU BORN?:1969 YOU WERE BORN IN THE YEAR 1.0000 OF FOCAL! IN WHAT YEAR WERE YOU BORN?:1950 YOU ARE TOO OLD FOR FOCAL, POPS IN WHAT YEAR WERE YOU BORN?:This program takes your year of birth and calculates what year A.F. (after Focal) you were born in.
Program lines in a Focal program are grouped into linegroups and line numbers within that group. The first line of the program line 01.10 is line 10 of group 01. The line numbers are the targets of the GOTO and the IF statements.
The ASK statement prompts on the attached teleprinter for input, while the TYPE statement outputs text on the teleprinter. Multiple items can be output to the teleprinter by appending each item after a comma. An exclamation mark (!) causes a linefeed and carriage return to be sent.
The SET statement assigns a value to a variable. This value can be the result of an expression.
The conditional IF statement can receive up to three line numbers as parameters (so-called Arithmetic IF). The program branches to the first linenumber if the result of the expression in parentheses is less than zero, to the second if the result is zero and to the third if the result is above zero.
On the GO command, Focal begins to run the program.
Focal prompts with a single asterisk (*) at the beginning of the line when it is expecting input.
Read more about this topic: FOCAL (programming Language)
Famous quotes containing the words sample and/or session:
“All that a city will ever allow you is an angle on itan oblique, indirect sample of what it contains, or what passes through it; a point of view.”
—Peter Conrad (b. 1948)
“I need not tell you of the inadequacy of the American shipping marine on the Pacific Coast.... For this reason it seems to me that there is no subject to which Congress can better devote its attention in the coming session than the passage of a bill which shall encourage our merchant marine in such a way as to establish American lines directly between New York and the eastern ports and South American ports, and both our Pacific Coast ports and the Orient and the Philippines.”
—William Howard Taft (18571930)