answersLogoWhite

0

A logic error (also known as a semantic error) is a flaw in the thought process behind a piece of code, in such that although the code itself is written correctly it does not serve the intended purpose for which it was written.

An example of this in basic English would be aiming to add 1 and 1 together to get 2, but accidentally using the minus symbol instead of the addition; the sum can still be done, but it will yield an incorrect result.

Transfer that to a simple bit of code then:

Dim a as Integer = 1

Dim b as Integer = 1

Dim c as Integer

c = a - b

MsgBox("Look! I added 1 and 1 together and got: " & c)

Obviously since the intent was to add two numbers together, there is a flaw in the logic of the code.

A logic error is notoriously difficult to debug from a program due to the fact the code itself is written perfectly correctly; this means the code will not crash and error detectors have no way of knowing what you intended the code to do if it worked correctly.

Logic errors are traditionally solved through the tedious method of tracking variables and going line by line through the code one step at a time, following it logically through each step until you find the exact point an incorrect value is generated; thus identifying the segment of faulty code.

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Psychology

Why is this an example of propaganda?

This is an example of propaganda because it presents information in a biased or misleading way to promote a particular agenda or point of view, often using emotionally charged language and appealing to people's emotions rather than logic.


Can emotions interfere with logic and investigation of facts?

Yes, in some cases emotions can interfere with logic and investigation of facts. Example: If one has a spouse or friend that has done something wrong then the person is more apt to believe their spouse or friend is innocent of any wrong doing.


How does someone become a logician?

The standard way to become a logician is by formal training in logic. Logic is a speciality area in philosophy, mathematics, and computer sicence. To become a logician ordinarily requires advanced training at the graduate level (master's or doctoral) in this specialty area.


What is complex but is based on units that are simple?

A computer is an example of something complex that is based on simple units. The computer consists of basic components like transistors and logic gates, which work together to perform complex functions like processing data and running software.


What is the bad logic type of propaganda?

One common type of bad logic in propaganda is the use of logical fallacies, such as ad hominem attacks, cherry-picking data, or appealing to emotions instead of reason. These tactics are used to manipulate or deceive the audience by presenting flawed arguments that may seem convincing on the surface but do not hold up to logical scrutiny.

Related Questions

Method for minimising logic error?

BASICALLY, to minimise logic error, you need to stop being a tutti and be more of a kutha


What type of procedural error often involves and error in logic?

Analysis


What type of error provides an incorrect result but is not a syntax or run time error?

A logic error.


What is a semantic error in vb and give examples?

An example of semantic error is: a+b = c.


Which type of error produces incorrect results but does not prevent the program from running?

Logic error.


What is logic error in c plus plus?

A logic error is an error that will not cause the program to crash, but will nevertheless cause the program to behave in a way that is unexpected or otherwise incorrect. By way of example, a program that converts Fahrenheit to Celsius will behave incorrectly if the program is written to multiply and divide first instead of adding or subtracting first (F-32*5/9=C instead of (F-32)*5/9=C). In this case, simply forgetting the enclosing parentheses caused the logic error.


Which type of error is is more difficult to detect and correct either syntax error or logic error?

The logic error is more difficult to detect and correct than the syntax error. The syntax error will fail compilation, and you will get a (relatively) clear indication of where the problem lies. The logic error, on the other hand, will give you a successful compilation, and a program that appears to run, although it will not give you the correct results. This causes you to perform (unit) testing and debugging of various levels.


What is the error called when it is caused by faulty logic and coding mistakes are?

Error caused by or contributed to by input from operators is called human error.


What is easiest for a programmer to use syntax or logic error?

Use neither. Error-free programs are the best.


What is the difference between a semantic error and logic error?

An error in the logic of a program means that the output of the program is faulty (eg the program tell you 2+2=5). An error in semantics in a program means that the program statements are not constructed properly and the usual result of this is that the program will not compile.


Difference between syntax error and runtime error?

Syntax error can be found during compilation. Runtime error can be found only when you are trying to execute your program. Syntax errors are those which are caused by incorrect usage of the programming language. All programming language compilers are designed to detect and report such errors done by the programmer Runtime errors are those which are caused by incorrect usage of programming logic. for example a runtime divide method will throw a run time error if the divisor is '0' because numerically you cannot divide a number by 0


A statement that contains an error in logic is?

Technically speaking, an "error in logic" (a fallacy) is a case where the premises do not properly support the argument made. Fallacies are not to be confused with factual errors, wherein the error is caused by a lack of proper information.