Syntax Error Versus Logic Error

◀ Debugging▶ Debugging via Standard Output
Amazon Every programmer knows that debugging is a time-consuming nightmare, so it makes a good candidate for programmers to learn how to deal with. There are generally two types of errors: syntax errors and logic errors.

Syntax errors occur when a program does not conform to the grammar of a programming language, and the compiler cannot compile the source file. Logic errors occur when a program does not do what the programmer expects it to do.

Syntax errors are usually easy to fix because the compiler will tell you where the error occurs and you simply fix the syntax error. For example you may miss a semicolon or a curly bracket where it’s supposed to be. Simply locate those errors and fix them.

The real pain in the neck are logic errors. For instance you may be writing a software application that solves a puzzle, but when you run it it tells you that the puzzle cannot be solved. After you dig through the program logic you realize you have done something wrong. After you fix the logic and run the program again it solves the puzzle successfully.

Logic errors can occur anywhere in the program. Freeing a program of logic errors is almost always what a programmer ends up doing, eventually successfully or unsuccessfully.
Next we will explore different ways to debug!
◀ Debugging▶ Debugging via Standard Output

Questions? Let me know!