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
Reserved word
(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!
==Distinction== When using an Interactive Development Environment (IDE) to develop a program, the IDE will generally highlight reserved words by displaying them in a different colour. In some IDEs, comments may also be highlighted (in yet another colour). This makes it easy for a programmer to notice unexpected use of a reserved word and/or failure to terminate a comment correctly. There may be reserved words which are not keywords. For example, in Java, <code>true</code> and <code>false</code> are reserved words used as Boolean (logical) literals. As another example, in Pascal, <code>div</code> and <code>mod</code> are reserved words used as operators (integer division and remainder). There may also be reserved words which have no defined meaning. For example, in Java, <code>goto</code> and <code>const</code> are listed as reserved words, but are not otherwise mentioned in the Java syntax rules. A keyword such as '''if''' or '''while''' is used during [[parser|syntax analysis]] to determine what sort of statement is being considered. Such analysis is much simpler if keywords are either reserved or stropped. Consider the complexity of using contextual analysis in Fortran 77 to distinguish: IF (B) l1,l2 ! two-way branch, where B is a boolean/logical expression IF (N) l1,l2,l3 ! three-way branch, where N is a numeric expression IF (B) THEN ! start conditional block IF (B) THEN = 3.1 ! conditional assignment to variable THEN IF (B) X = 10 ! single conditional statement IF (B) GOTO l4 ! conditional jump IF (N) = 2 ! assignment to a subscripted variable named IF PL/I can also allow some apparently confusing constructions: IF IF = THEN THEN ... /* (the second <code>IF</code> and the first <code>THEN</code> are variables */
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)