Content deleted Content added
Enterprisey (talk | contribs) m →Language: Citations; +clause |
Enterprisey (talk | contribs) m ref naming |
||
Line 8:
== Language ==
Programs in GolfScript consist of lists of items, each of which is pushed onto the [[Stack (abstract data type)|stack]] as it is encountered with the exception of variables which have code blocks as their value, in which case the code is executed. When a variable assignment (carried out through the placement of a colon before the name of the variable) is encountered, the top item on the stack is popped and assigned to the variable.<ref name="
GolfScript attempts to reach its goal of solving problems in as few keystrokes as possible through the use of single symbols to represent high-level operations.<ref name="official website" /> A single symbol can stand for multiple operations depending on the type of the arguments passed to it,<ref>{{Cite web|url = http://www.golfscript.com/golfscript/quickref.html|title = GolfScript Quick Reference|date = 18 May 2012|accessdate = 25 June 2014|website = GolfScript}}</ref> and can even be reassigned and used like a variable.<ref name="
=== Input and output ===
If input is supplied to a GolfScript program, it is pushed onto the stack as a string before the program is executed. Output is provided via the stack's contents being printed when execution of the program finishes.<ref name="
== Examples ==
Line 19:
=== Hello world ===
The traditional [[Hello world program]] can be written in GolfScript as:<ref name="
"Hello World!"
|