What is the different between variable & constant? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the different between variable & constant?

I am confusing about variable & constant please explain it.

29th Mar 2018, 8:06 AM
ⓤⓝⓢⓜⓐⓡⓣ ⓑⓞⓨ
ⓤⓝⓢⓜⓐⓡⓣ ⓑⓞⓨ - avatar
9 Answers
+ 6
constant means a value that never changes for example if you create a constant variable a and assign it with 10..... then you can't change value of a..... but if you create a simple variable a and assign it with 10..... you are free to change it's value any time in the program. 😊
29th Mar 2018, 8:11 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Constant = Always its value is fixed. Variable = Its value changes when condition / conditions is / are changed.
29th Mar 2018, 9:54 AM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
+ 2
constant which does not change their state and value e.g=1,2,3 where 1 is constant it can not change his value like 1=2 it's wrong. variable which can change their value means they contain some value like y=2 and y can change his value like y=6,y=8 and so on.
30th Mar 2018, 3:55 AM
Maninder $ingh
Maninder $ingh - avatar
0
thnks
29th Mar 2018, 3:45 PM
najib
0
Constant ="Values that do not change" eg. 10,1.5,"a" Variable =."sort of a container to contain constants" eg. x=10
29th Mar 2018, 7:32 PM
Avinash Tripathi
0
variables value can be changed anywhere u want in the program.. but constant once declared and initialized will have the same value even if u try to change it anywhere in the program..
29th Mar 2018, 8:20 PM
Mayank kumar
Mayank kumar - avatar
0
constant = fixed value variable = value changes over time
29th Mar 2018, 9:59 PM
dAisy
dAisy - avatar
0
@dAisy, time itself is a variable.
30th Mar 2018, 3:36 AM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
0
constant variable has its fix value and that is initialized at the time of declaration , later we can not change that value. If we do so that will cause an error. Variables value can be changed any where in program.
7th Jul 2018, 6:29 AM
Sanjit Paul
Sanjit Paul - avatar