Pin
Send
Share
Send


Constant is what consists (which is manifest or is registered) or that has proof (certainty, perseverance). Something constant is durable, repeated or persistent . For example: "The constant effort of the American led him to a new victory in the tournament", “My grandfather always tells me that to be successful in business it is essential to be constant and never give up in the face of adversity”, “Students of La Plata is the most constant Argentine team in recent years”.

For the mathematics, a constant is a quantity that has a fixed value in a certain calculation, process or equation. This means that the constant is a permanent value that cannot be modified within a certain context. Typically, it relates to a variable (whose values ​​can be modified).

A physical constant it is the invariable value of a physical magnitude along the weather . An example of this, mentioned very often even in non-scientific fields, is the speed of light in a vacuum (299,792,458 m / s).

When it exists, at least in theory, a constant speed, travel times can be estimated. If a car travels at a constant speed of 100 kilometers per hour, it takes four hours to travel a journey of 400 kilometers. As the constant speed does not exist in practice, it is common for these types of estimates to be made with the average speed or average speed.

In the field of programming computing , a constant is that value that cannot be modified during the execution of a Program . It corresponds, therefore, to a fixed length in a reserved area in the memory of the computer .

Its applications, as well as its methods of implementation, are diverse; Usually, they are used to determine values ​​such as minimum and maximum speeds, margins of mistake, fixed dimensions of elements that must be drawn many times throughout the execution and state numbers of the various machines that usually compose a program. This last point is essential, since the state machine represents a very efficient model of organization.

Take as an example a very simple application, which presents the user with a form with the fields "name" and "password" to check the data once entered and that will only be closed once the result is positive. Basically, it can be said that this program will go through the following states from its start to its end:

0: it will load the resources necessary for its graphic representation, such as images for the buttons and fonts for the text;
1: will create the form, setting the values of all its components (text entry boxes, labels, buttons, pop-up messages) and will display it on the screen;
2: will remain waiting for the user to enter their information and confirm that action;
3: will proceed to verify the data and give one of two possible results: "correct", in which case it will be closed; "incorrect", which will lead to a state in which it will display a message asking the user to repeat the procedure;
4: while the notification of incorrect data, the program will wait for an action by the user to return to the state 1, probably changing the creation of the form (since it already exists) by a simple cleaning of your income fields.

While the actual structure of a application is more complex, the given example serves to demonstrate the efficiency and degree of control that allows the provision of states in a machine. In the code, which may be different for each programmer, each state is represented by a constant, which receives a name (such as ES_CARGA, WAIT) and is usually associated with a numerical value.

Pin
Send
Share
Send