What is the difference between a Syntax Error a Logic Error and an Execution Error in a program's code?


Syntax Error - Occurs when the code isn't formatted or typed correctly. i.e. In python, typing If instead of if because it only recognizes lowercase.

Logical Error - Occurs when there is a fallacy of reasoning. i.e. In python, typing if x < 0 and x > 5. Since a value can't be less than 0 and greater than 5, a logical error will occur.


a) Syntax Error

Definition : An error cause by violation of the programming language used.

Symptoms : Code fails to compile (error message from compiler)

b) Logical Error

Definition : An error caused by violation of logic (range, comparison, etc.). This error will NOT crash the program.

Symptoms : Unexpected output

c) Runtime Error/Execution Error

Definition : Any error, normally logical error that cause the program to crash.

Symptoms : Program crashes.