What Does State Mean?

In computer science, the state of a program is defined as its condition regarding stored inputs. The term “state” here is used similarly to how it is used in science — whereas the state of an object, for instance, as a gas, liquid or solid, shows its current physical makeup, the state of a computer program shows its current values or contents.


Techopedia Explains State

The stored inputs in a computer program are stored as variables or constants. In analyzing the state of a program, developers may go through and look at values that are stored in these inputs. As the program is executed, its state may change — variables can change and the values that are stored in memory can also change. For example, a control variable such as a variable used in a loop changes the state of the program at each iteration. Looking at the state of a program can be considered a testing method or a way of analyzing the code base.

Developers also talk about different types of states, for example, contrasting two complementary states that are not contradictory to one another or contrasting two different states resulting from different operations.


Related Terms

Latest Computer Science Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…