Keyword (computer programming): Difference between revisions

Content deleted Content added
DaBler (talk | contribs)
m removed insignificant language
oops, redirect
 
(44 intermediate revisions by 34 users not shown)
Line 1:
#REDIRECT [[Reserved word]]
In [[computer programming]], a '''keyword''' is a [[word]] or [[identifier]] that has a particular meaning to the [[programming language]]. The meaning of keywords — and, indeed, the meaning of the notion of ''keyword'' — differs widely from language to language.
 
[[Category:Programming language topics|Keyword (computer)constructs]]
In many languages, such as [[C (programming language)|C]] and similar environments like [[C++]], a ''keyword'' is a [[reserved word]] which identifies a syntactic form. Words used in [[control flow]] constructs, such as <tt>if</tt>, <tt>then</tt>, and <tt>else</tt> are keywords. In these languages, keywords cannot also be used as the names of variables or functions.
[[Category:Programming language topics]]
 
Some languages, such as [[PostScript]], are extremely liberal in this approach, allowing core keywords to be redefined for specific purposes.
 
In [[Common Lisp]], in contrast, ''keywords'' (or ''keyword symbols'') are a special sort of symbol, or identifier. Unlike other symbols, which usually stand for variables or functions, keywords are self-[[quoting]] and evaluate to themselves. Keywords are usually used to label named arguments to functions, and to represent symbolic values.
 
Languages vary as to what is provided as a keyword and what is a [[library routine]]. Some languages, for instance, provide keywords for input/output operations whereas in others these are library routines. In [[Python (programming language)|Python]] and many [[BASIC]] dialects, <code>print</code> is a keyword. In contrast, the C and Lisp equivalents <code>printf</code> and <code>format</code> are functions in the standard library.
 
In languages with [[macro (computer science)|macros]] or [[lazy evaluation]], control flow constructs such as <code>if</code> can be implemented as macros or functions. In languages without these expressive features, they are generally keywords.
 
==See also==
*[[Java keywords]]
 
{{comp-sci-stub}}
{{language-stub}}
 
[[da:Nøgleord (programmering)]]
[[de:Schlüsselwort (Informatik)]]
[[es:Palabra clave]]
[[fr:Mot clé]]
[[hu:Kulcsszó]]
[[nl:sleutelwoord]]
[[pl:Słowo kluczowe (informatyka)]]
[[pt:Palavra chave]]
 
[[Category:Programming language topics|Keyword (computer)]]