Which Of The Following Is Not A Keyword: Complete Guide

7 min read

Which of the Following Is Not a Keyword?
Now, *The short version is: you’re probably mixing up reserved words, identifiers, and library names. Let’s clear it up It's one of those things that adds up..


Ever stared at a list of words in a language spec and wondered, “Is that really a keyword, or just a fancy function name?Plus, ” You’re not alone. Worth adding: in practice, developers waste minutes—sometimes hours—trying to remember whether await belongs in the reserved‑word bucket or lives in a library. The answer matters because using a non‑keyword where a keyword is expected throws a syntax error, while treating a keyword as a normal identifier can silently change program logic.

Below we’ll unpack what “keyword” really means, why it matters, and walk through the most common traps. By the end you’ll be able to glance at any list and instantly spot the odd one out.


What Is a Keyword?

A keyword (sometimes called a reserved word) is a token that the language’s parser has already assigned a special meaning. You can’t repurpose it for variable names, function names, or class names without breaking the grammar Turns out it matters..

Think of a keyword as a traffic sign. Day to day, the sign says “Stop” and you can’t rename it “Pause” just because you feel like it—drivers expect the exact word. In most languages the set of keywords is fixed, though some (like Python) let you add new ones with future‑proofing syntax Nothing fancy..

Reserved vs. Contextual

Not every word that looks special is a hard‑stop. Some languages have contextual keywords—they only act like keywords in certain positions. Take this: C# treats await as a keyword only inside an async method. Outside that context it’s just an identifier.

Where Keywords Live

  • Core language spec – The official list you’ll see in the language reference.
  • Standard library – These are not keywords, even if they feel “built‑in”. Think print in Python or println in Java.
  • Frameworks – Anything added by a third‑party library is definitely not a keyword.

Why It Matters / Why People Care

If you try to name a variable class in Java, the compiler screams. Even so, that’s a hard stop because class is a keyword. But if you name a variable list in Python, you’re fine—list is a built‑in type, not a keyword, even though it shadows the original.

Real‑world pain points

  1. Syntax errors – Accidentally using a keyword where an identifier belongs stops your code from even compiling.
  2. Readability – Overloading a non‑keyword with a name that looks like a keyword (e.g., await in a non‑async context) can confuse teammates.
  3. Portability – A word that’s a keyword in one language might be free in another. When you copy‑paste snippets, you can introduce subtle bugs.

Bottom line: Knowing the difference saves you from debugging rabbit holes that could have been avoided with a quick look‑up.


How It Works (or How to Do It)

Below is a step‑by‑step guide to determine whether a given word is a keyword in a particular language. The process works for any language—JavaScript, Python, Java, C#, you name it.

1. Check the Official Language Specification

Every language publishes a reference that lists its reserved words. Grab the PDF or the online docs and search for the word Most people skip this — try not to..

  • JavaScript – MDN’s “Keywords” page.
  • Python – The “Keywords” section of the language reference.
  • Java – The Java Language Specification, chapter “Keywords”.

If the word appears there, it’s a keyword.

2. Use the Language’s REPL or Compiler

Most interpreters will flag a keyword used as an identifier.

>>> def for(): pass
  File "", line 1
    def for(): pass
        ^
SyntaxError: invalid syntax

If you get a syntax error, you’ve hit a keyword That's the part that actually makes a difference..

3. Look for Contextual Rules

Some words only become keywords in specific constructs.

  • C#async and await are contextual.
  • Swifttry is a keyword only before a throwing call.

Read the spec’s “contextual keywords” section to see the rules.

4. Search the Standard Library

If the word lives in the standard library but not in the keyword list, it’s not a keyword. Here's a good example: len in Python is a built‑in function, not a reserved word Simple, but easy to overlook..

5. Verify with a Linter or Static Analyzer

Tools like ESLint (JavaScript) or pylint (Python) will warn you when you misuse a keyword.

pylint myscript.py
# → Using keyword as variable name: 'global'

6. Cross‑Check Across Languages

If you’re working in a polyglot environment, keep a quick cheat sheet. Here’s a tiny table for the most common “gotchas”:

Word JavaScript Python Java C# (contextual?)
class ✅ keyword ❌ built‑in ✅ keyword ✅ keyword
await ✅ keyword ✅ keyword (since 3.5) ❌ identifier ✅ contextual
enum ✅ keyword ❌ identifier ✅ keyword ✅ keyword
list ❌ identifier ✅ built‑in ❌ identifier ❌ identifier

If the word is a keyword in one column but not the others, you’ve found a potential source of confusion.


Common Mistakes / What Most People Get Wrong

Mistake #1 – Assuming Library Functions Are Keywords

Newbies often think print, len, or map are keywords because they’re everywhere. Still, they’re actually just functions or methods. You can shadow them without a syntax error, though you’ll lose the original behavior.

Mistake #2 – Forgetting Contextual Keywords

I’ve seen developers write await in a plain function and wonder why it “works” in Python 3.6+. It only works inside an async def. Also, outside, you’ll get a SyntaxError: 'await' outside async function. The same goes for async in C#.

Mistake #3 – Mixing Up Case Sensitivity

Languages differ: NULL is a keyword in SQL, but null is a keyword in JavaScript and Java. Now, in Python, None (capital N) is a built‑in constant, not a keyword. Miss the case and you might create a new variable unintentionally.

Mistake #4 – Over‑Shadowing Built‑Ins

Even though list isn’t a keyword in Python, redefining it can bite you later:

list = [1, 2, 3]   # shadows built‑in type
list('abc')        # TypeError: 'list' object is not callable

It’s not a syntax error, but it’s a logic error that can be hard to track.

Mistake #5 – Assuming All Future Reserved Words Are Off‑Limits

Languages sometimes reserve future keywords (e., enum in older JavaScript versions). g.You can still use them as identifiers in current specs, but it’s risky—future versions might break your code Not complicated — just consistent..


Practical Tips / What Actually Works

  1. Keep a personal cheat sheet – A one‑page PDF with the top 20 keywords for each language you use saves time.
  2. Name variables descriptively, not cleverly – Avoid names that look like keywords (className is fine; class is not).
  3. put to work IDE autocomplete – Modern editors highlight keywords in a different color. If it’s gray, it’s likely a keyword.
  4. Run a quick lint check before committing – Set up a pre‑commit hook that runs the linter; it will catch accidental keyword usage.
  5. When in doubt, test it – Drop a tiny snippet into the REPL. If it compiles, you’re good.
  6. Avoid shadowing built‑ins – Even if not a keyword, naming a variable dict or set in Python makes your code harder to read.
  7. Document any intentional shadowing – If you must reuse a name, add a comment explaining why.

FAQ

Q: Is var a keyword in JavaScript?
A: Yes. var declares a variable and can’t be used as an identifier.

Q: Can I use await as a function name in Python 3.9?
A: Only inside a non‑async function. Outside an async def, await is a regular identifier, but using it that way is confusing and discouraged And that's really what it comes down to..

Q: What about enum in C++?
A: enum is a keyword that starts an enumeration type. It’s not a library function, so you can’t name a variable enum Took long enough..

Q: Does null count as a keyword in SQL?
A: No. SQL uses NULL (all caps) as a special literal, but it isn’t listed among the reserved words in the standard. Still, treat it like a keyword Not complicated — just consistent..

Q: Are there languages without any keywords?
A: Practically no. Even minimalist languages need at least a few reserved words (e.g., if, else, while). Some esolangs try to avoid them, but they’re the exception, not the rule.


So, the next time you glance at a list and wonder, “Which of the following is not a keyword?” remember: check the spec, test it in the REPL, and keep an eye on context. It’s a tiny step that prevents a lot of head‑scratching later. Happy coding!

Brand New Today

Just Dropped

Based on This

You Might Want to Read

Thank you for reading about Which Of The Following Is Not A Keyword: Complete Guide. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home