Like a usual language which people speak let’s say English, there are a number of factors/rules/guidelines involved in forming a sentence, similarly for Programming Languages as well there does exist certain rules.
Most commonly these basic rules of a specific programming language are called Lexcial Structure of that langauge. Most of languages out there have a specific/unique lexical structure based upon which code is written using that Programming Language.
Lexical structure of a programming language is the set of elementary rules that specifies how to write programs using that language. It’s lowest level syntax of language, specifying things like how does variables look like in language.
So always try to double check whenever your using one variable name again and again in the code. Otherwise when you run the code, you may see errors like ‘Variable not defined’.
- Single line comment( //This is a comment)
- Multiple Lines comment( /*This is a comment*/ )
For writing code in any programming language, there need to be certain guidelines around who variables/functions should be declared.
Otherwise there will be a lot of conflict between Programmer Declared Entities and inbuilt language keywords. Inbuilt keywords of a programming language are called Reserved Words; best practice should be avoid using these keywords for declaring variables/functions.
So you should avoid using these reserved words as variable decelerations.
Only not these are some of common words, which are reserved. There does exist many other words, global variables and functions, use of which should be avoided by programmer. Here is the table containing all of those –
- normal objects/Functions
- Using inside Classes
- Using constructor for initialising a Class Object