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:
“The present war having so long cut off all communication with Great-Britain, we are not able to make a fair estimate of the state of science in that country. The spirit in which she wages war is the only sample before our eyes, and that does not seem the legitimate offspring either of science or of civilization.”
—Thomas Jefferson (17431826)
“The bar is the male kingdom. For centuries it was the bastion of male privilege, the gathering place for men away from their women, a place where men could go to freely indulge in The Bull Session ... the release of the guilty anxiety of the oppressor class.”
—Shulamith Firestone (b. 1945)