Keyword
In one line
A keyword is a reserved word that has special meaning in the language and cannot be used as a variable name.
In simple words
A keyword is a word that the programming language reserves for its own use. Keywords define the syntax and structure of the language — things like let, if, for, function, return, class, while.
Because keywords have special meaning, you cannot use them as variable or function names. You cannot write let if = 5; because if is a keyword. Each language has its own set of keywords: JavaScript has about 60, Python about 35, Java about 50.
Keywords are how you talk to the computer in its own language. When you write if (x > 0), the keyword if tells the interpreter "this is a conditional statement." Learning the keywords of a language is a big part of learning the language itself.
Example
// Keywords in JavaScript:
let x = 5; // 'let' is a keyword
if (x > 0) { // 'if' is a keyword
return x; // 'return' is a keyword
}
// This would cause an error:
// let let = 10; // 'let' cannot be a variable namelet, if, return, function, for, while, const, class are all keywords. They cannot be used as identifiers.
Related terms
Related Resources
Related Lessons
- What Is Programming?
Learn about programming fundamentals.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.