Share on Facebook Share on Twitter Email
Answers.com

Keyword

 
Wikipedia: Keyword (computer programming)

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.

In many languages, such as 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 if, then, and else are keywords. In these languages, keywords cannot also be used as the names of variables or functions.

Some languages, such as PostScript, are extremely liberal in this approach, allowing core keywords to be redefined for specific purposes.

In Common Lisp, the term "keyword" (or "keyword symbol") is used for 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 (versions earlier than 3.0) and many BASIC dialects, print is a keyword. In contrast, the C and Lisp equivalents printf and format are functions in the standard library.

Typically, when a programmer attempts to use a keyword for a variable or function name, a compilation error will be triggered. In most modern editors, the keywords are automatically set to have a particular text colour to remind or inform the programmers that they are keywords.

In languages with macros or lazy evaluation, control flow constructs such as if can be implemented as macros or functions. In languages without these expressive features, they are generally keywords.

See also


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
Shopping: Keyword
Top
 
 
Learn More
glossary (computer science)
keyword parameter (computer science)
search engine (computer science)

What is keyword ranking? Read answer...
What are the keywords in Java? Read answer...
Who discovered keyword? Read answer...

Help us answer these
What are keyword important?
What are the keywords to halogens?
What is a keyword to division?

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Keyword (computer programming)" Read more