Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
ALGOL 60
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Code sample comparisons=== ====ALGOL 60==== '''procedure''' Absmax(a) Size:(n, m) Result:(y) Subscripts:(i, k); '''value''' n, m; '''array''' a; '''integer''' n, m, i, k; '''real''' y; '''comment''' The absolute greatest element of the matrix a, of size n by m, is copied to y, and the subscripts of this element to i and k; '''begin''' '''integer''' p, q; y := 0; i := k := 1; '''for''' p := 1 '''step''' 1 '''until''' n '''do''' '''for''' q := 1 '''step''' 1 '''until''' m '''do''' '''if''' abs(a[p, q]) > y '''then''' '''begin''' y := abs(a[p, q]); i := p; k := q '''end''' '''end''' Absmax; Implementations differ in how the text in bold must be written. The word 'INTEGER', including the quotation marks, must be used in some implementations in place of '''integer''', above, thereby [[stropping (syntax)|designating]] it as a special keyword. Following is an example of how to produce a table using [[Elliott 803]] ALGOL:<ref>[http://www.billp.org/ccs/A104/ "803 ALGOL"], the manual for [[Elliott 803]] ALGOL</ref> FLOATING POINT ALGOL TEST' BEGIN REAL A,B,C,D' READ D' FOR A:= 0.0 STEP D UNTIL 6.3 DO BEGIN PRINT {{abbr|PUNCH(3)|sends output to the teleprinter rather than the tape punch.}},££L??' B := SIN(A)' C := COS(A)' PRINT {{abbr|PUNCH(3)|sends output to the teleprinter rather than the tape punch.}},{{abbr|SAMELINE|suppresses the carriage return + line feed normally printed between arguments.}},{{abbr|ALIGNED(1,6)|controls the format of the output with 1 digit before and 6 after the decimal point.}},A,B,C' END' END' ====ALGOL 60 family==== Since ALGOL 60 had no I/O facilities, there is no portable [[hello world program]] in ALGOL. The following program could (and still will) compile and run on an ALGOL implementation for a Unisys A-Series mainframe, and is a straightforward simplification of code taken from The Language Guide<ref>{{cite web |url=http://www.engin.umd.umich.edu/CIS/course.des/cis400/ |title=The ALGOL Programming Language |website=www.engin.umd.umich.edu |access-date=11 January 2022 |archive-url=https://web.archive.org/web/20100210185248/http://www.engin.umd.umich.edu/CIS/course.des/cis400/algol/algol.html |archive-date=10 February 2010 |url-status=dead}}</ref> at the [[University of Michigan]]-Dearborn Computer and Information Science Department Hello world! ALGOL Example Program page.<ref>{{cite web |url=http://www.engin.umd.umich.edu/CIS/course.des/cis400/algol/hworld.html |title=Hello world! Example Program |website=www.engin.umd.umich.edu |access-date=11 January 2022 |archive-url=https://web.archive.org/web/20100204112923/http://www.engin.umd.umich.edu/CIS/course.des/cis400/algol/hworld.html |archive-date=4 February 2010 |url-status=dead}}</ref> BEGIN FILE F(KIND=REMOTE); [[EBCDIC]] ARRAY E[0:11]; REPLACE E BY "HELLO WORLD!"; WRITE(F, *, E); END. Where * etc. represented a format specification as used in FORTRAN, e.g.<ref>[[Fortran#"Hello, World!" example]]</ref> A simpler program using an inline format: {{sxhl|2=m2|1=<nowiki/> BEGIN FILE F(KIND=REMOTE); WRITE(F, <"HELLO WORLD!">); END. }} An even simpler program using the Display statement: {{sxhl|2=m2|1= BEGIN DISPLAY("HELLO WORLD!") END.}} An alternative example, using Elliott Algol I/O is as follows. Elliott Algol used different characters for "open-string-quote" and "close-string-quote", represented here by {{color box|rgba(255,255,255,0)|border=silver| [[‘]]}} and {{color box|rgba(255,255,255,0)|border=silver| [[Single quotation mark|’]]}}. {{sxhl|2=pascal|1=<nowiki/> program HiFolks; begin print ‘Hello world’ end; }} Here's a version for the Elliott 803 Algol (A104) The standard Elliott 803 used 5-hole paper tape and thus only had upper case. The code lacked any quote characters so [[£]] (pound sign) was used for open quote and [[?]] (question mark) for close quote. Special sequences were placed in double quotes (e.g., £L?? produced a new line on the teleprinter). HIFOLKS' BEGIN PRINT £HELLO WORLD£L??' END' The [[ICT 1900 series]] Algol I/O version allowed input from paper tape or punched card. Paper tape 'full' mode allowed lower case. Output was to a line printer. Note use of '(', ')', and %.<ref>{{cite web|url=http://www.icl1900.co.uk/techpub/tp3340.djvu|title=ICL 1900 series: Algol Language|publisher=ICL Technical Publication 3340|year=1965}}</ref> 'PROGRAM' (HELLO) 'BEGIN' 'COMMENT' OPEN QUOTE IS '(', CLOSE IS ')', PRINTABLE SPACE HAS TO BE WRITTEN AS % BECAUSE SPACES ARE IGNORED; WRITE TEXT('('HELLO%WORLD')'); 'END' 'FINISH'
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)