Explain how a variable differs from a constant.

October 14, 2019

Explain how a variable differs from a constant.




Variables are symbols that act as placeholders for numbers (or, potentially, strings and other data). Variables are usually visualized as letters or a phrase, and in certain cases variables can have more than one possible value. Most often variables are used to indicate that a number in an equation or expression is not yet known.

Constants are a type of value used most often in mathematical expressions and equations. Like the name implies, constants do not change in value over time. Constants can be any type of number (not just an integer or fraction, for instance).

Difference between Constants and Variables

1. Constants are usually written as a number, such as 12 or -4.23. However, some important constants can have names and unique symbols that are recognizable throughout mathematics and sciences. For instance, pi (symbolized as π) is a common constant in geometry, calculus, and other sciences. Because pi is an irrational number with a decimal expansion that continues infinitely without a repeating pattern, it cannot be fully written and is therefore simply indicated by its symbol or name.
2. Theoretically, a variable can be symbolized by anything except a constant number. Variables are most commonly written as a single letter, especially x and y. These letters can be chosen at random, and are simply placeholders for the actual value that the variable represents. In computer programming, variables are more commonly written as a phrase that refers to the purpose of the variable (such as bonusDollars or numberOfEmployees).

Share this article :
Blogger Tips and TricksLatest Tips And TricksBlogger Tricks

FB Page

 
@ELITE_Mv
Copyright © 166/A-1/2017/19. ELITE Institute - All Rights Reserved