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
Icon (programming language)
(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!
===Basic syntax=== The Icon language is derived from the [[ALGOL]]-class of [[structured programming]] languages, and thus has syntax similar to [[C (programming language)|C]] or [[Pascal (programming language)|Pascal]]. Icon is most similar to Pascal, using {{code |1=:=}} syntax for assignments, the {{code|procedure}} keyword and similar syntax. On the other hand, Icon uses C-style braces for structuring execution groups, and programs start by running a procedure called {{code|main}}.{{sfn|Griswold|Griswold|2002|p=xv}} In many ways Icon also shares features with most [[scripting language]]s (as well as [[SNOBOL]] and SL5, from which they were taken): variables do not have to be declared, types are cast automatically, and numbers can be converted to strings and back automatically.{{sfn|Griswold|Griswold|2002|p=xvi}} Another feature common to many scripting languages, but not all, is the lack of a line-ending character; in Icon, lines that do not end with a semicolon get ended by an implied semicolon if it makes sense.{{sfn|Griswold|Griswold|2002|p=10}} Procedures are the basic building blocks of Icon programs. Although they use Pascal naming, they work more like C functions and can return values; there is no {{code|function}} keyword in Icon.{{sfn|Griswold|Griswold|2002|p=1}} <syntaxhighlight lang="icon"> procedure doSomething(aString) write(aString) end </syntaxhighlight>
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)