成人快手

Writing error-free codeLogic 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 of Computer ScienceProgramming

Logic errors

Logic errors occur when there is a fault in the logic or structure of the problem.

Logic errors do not usually cause a program to crash. However, logic errors can cause a program to produce unexpected results.

A logic error in programming will cause your program to have unexpected results. If we give our instructions in the wrong order, our program will still run but not how we intended it.

Types of logic error

More than one type of logic error may exist. Parts of the program may:

  • be in the wrong
  • have the wrong expression
  • use the wrong
  • be missing altogether

Any one or more of these errors may exist in a program, and each will cause the program to behave unexpectedly.