EDDYMENS

Last updated 2022-11-05 03:50:45

What Is A Keyword?

Table of contents

Definition

Keywords are words that have a predefined meaning in a programming language. Keywords are reserved words that developers or programmers cannot use as the name of say a variable [→], constants, and functions [→] in most programming languages [→].

Any part of the syntax [→] where the developer has the option to use any name they choose must not clash with the reserved words of that language. They convey a specific instruction and so using it as a name of something in your code might lead to confusion during compile time.

Use Cases and Examples

For example, some of the keywords in the C programming language include:

  • int: Highlights that the variable will hold an integer value.
  • long: Highlights that the variable will hold a large integer value.
  • break: Used to immediately terminate any loop [→] or iterator [→].
  • if: Allows the program to enter a specific code block once certain conditions are met.

All the above keywords are frequently used by programmers while writing C code [→]. Keywords can be different between programming languages but many languages share common keywords like if.

Summary

Keywords in a programming language are usually the key things that help a compiler [→] or interpreter [→] break down code into an abstract syntax tree [→] to further convert the code into instructions the computer can execute.

Here is another article you might like 😊 "Diary Of Insights: A Documentation Of My Discoveries"