The Three Types of Errors in Programming

In the world of programming there are three types of errors that stand in your way. They are...

  • Syntax Errors
  • Runtime Errors
  • Logic Errors

Let’s discuss some definitions, examples and strategies to overcome these errors.

Syntax Errors

A syntax error shows up when you are typing and trying to run your code. It indicates an issue with the structure or “syntax” of your code. Syntax errors can be caused by misspelled keywords, incorrect variable names, missing semicolons and unmatched brackets. To resolve a syntax error, have a look on or around the line number of the error for something small that is out of place. If you are using an IDE. then the error should be marked with a jagged red underline.

Runtime Errors

A runtime error happens when you try to run your program. They are also called runtime exceptions, failures or crashes. Runtime errors indicate instability in your code. They can be caused by memory leaks, stack overflows and array overruns. These errors can be difficult to resolve. Try changing the input values to your program, adding more logging or setting a breakpoint to inspect the values in your code with a debugger.

Logic Errors

A logic error happens when your code is valid however the output is wrong. Logic errors can cause a wrong answer, a blank screen or some other strange behavior. To fix logic errors, try fixing your indentation, tracing through your code by hand or adding unit tests to your code base.

In Summary

So in summary, syntax errors are typos, runtime errors are crashes and logic errors are wrong answers. By trying some of the strategies above you can streamline your development process and improve the overall quality of your code.

If you need more help with program fundamentals visit for more free resources.

Back to Posts