Writing error-free codeSyntax errors

When writing programs, code should be as legible and error free as possible. Debugging helps keep code free of errors and documenting helps keep code clear enough to read.

Part ofComputer ScienceProgramming

Syntax errors

is the spelling and grammar of a . Programming languages have rules for spelling, punctuation and grammar, just like the English language. In programming, a 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 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
  • incorrectly spelled
  • 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.