What Is a Syntax Error?

What Is a Syntax Error?

In computing, a syntax error is an error in the use of the programming language resulting in the inability to execute the program. Computer programs need to follow the correct programming syntax strictly in order to work; even slight mistakes make the program invalid.

Some common syntax errors include an incorrect, missing or extra punctuation; use of a variable that the program does not recognize; and an incorrect ordering of the words in the source code. The compiler usually indicates the probable location of the error; it is either on the particular line of code listed or the line before it. For mistakes in nested brackets, the error is typically at the beginning of the nested block.