Syntax errors

Syntax is the spelling and grammar of a programming language. Programming languages have rules for spelling, punctuation and grammar, just like the English language. In programming, a syntax error occurs when:

  • there is a spelling mistake
  • there is a grammatical mistake

Syntax errors will cause a program to crash or not run at all. The program may run until it encounters a syntax error, then it will stop.

A syntax error in programming will cause your program to crash or shut down. If we misspell our command, our program will stop functioning.

Types of syntax error

More than one type of syntax error may exist. There may be:

  • incorrectly spelled statements
  • incorrectly spelled variables
  • missing punctuation (quotes, brackets, etc)

Any one or more of these errors may exist in a program, and each will cause the program to crash or not run at all.