Fact Checked

What Is an Undefined Value?

Helen Akers
Helen Akers

An undefined value typically occurs when there is an error in the code of a computer software program. Usually the variable that the program has been instructed to look for is not valid or does not have a value that matches with what the code is looking for. For example, one portion of the software application's code may define the variable as a letter, which does not correspond to the command function that instructs the program to look for a number.

Since software applications are written in code, certain commands and functions require some type of correlation. When the program determines that it has an undefined value, it will usually return an error message. Savvy programmers will usually be able to determine how to correct an undefined value from the language contained in the error message or log.

Man holding computer
Man holding computer

A null pointer is also considered to be an undefined value. In computing, this is equivalent to the absence of a value or object. It is something that the program cannot associate with a valid object, and an attempt to do so will often result in an error that causes termination of the program. The lack of a valid object or value does not necessarily mean that the variable does not exist, but that the program is not able to match it to something that makes sense.

Programming errors that create an undefined value might define a variable such as "name" as being equivalent to a semicolon. When a function that is looking for "name" tries to match the semicolon as the defined value, it realizes that a semicolon isn't a name. As far as the program is concerned this is not valid and the function cannot proceed any further.

Variables can be checked to see if they contain undefined values. One way to test for this is to contrast the variable against the value "undefined" or "null." Most programmers will be able to perform these tests. Since different software programs are written in different programming languages, the process and wording may vary.

Software programmers can also change the coding of the program to fix any errors pertaining to undefined values. They would simply need to make sure that the manner in which the variables are defined is congruent with what the function is looking for. Sometimes the tests or error messages will point them in the right direction or they may need to do a thorough, line by line examination of the code.

You might also Like

Discuss this Article

Post your comments
Forgot password?
    • Man holding computer
      Man holding computer