Difference between revisions of "Logic Error"

esse quam videri
Jump to: navigation, search
(Created page with " =Definition= =Relevance= =Explanation= =Resources= == See also == ==Notes== ==External Links== Category:Programming Language Concepts Category:Object Orient...")
 
 
Line 1: Line 1:
  
 
=Definition=
 
=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=
 
=Relevance=
 
+
This is important as recognizing logic errors early can speed up the time it takes to finish a program.
=Explanation=
+
=Example=
 +
<syntaxhighlight lang ="csharp">
 +
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.
 +
}
 +
</syntaxhighlight>
  
  
  
=Resources=
 
 
== See also ==
 
== See also ==
 +
*[[Syntax Error]]
  
  
==Notes==
+
=External Links=
 
+
https://en.wikipedia.org/wiki/Logic_error
 
 
==External Links==
 
  
  

Latest revision as of 17:47, 8 August 2019

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