Logic Error

esse quam videri
Revision as of 17:47, 8 August 2019 by Pedro (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Definition

A logic error is a type of error that has to do with a user's code not performing as expected. Logic errors may be difficult to spot as well because they are still valid code and will not cause the program to crash. Logic errors are also known as "bugs" in code.

Relevance

This is important as recognizing logic errors early can speed up the time it takes to finish a program.

Example

float Average(float number1, float number2)
{
    return number1 + number2 / 2; // This is a logic error because number1 + number2 is not in parenthesis. This equation is number 1 + (number2 / 2) instead of (number1 + number2) / 2.
}


See also


External Links

https://en.wikipedia.org/wiki/Logic_error