32.4k views
0 votes
What is the difference between a constant and a variable

User Ianml
by
8.4k points

2 Answers

2 votes

A constant never changes. Its value is constant, which is a big part of the reason why it's called a "constant". " 42 " is constant. It doesn't depend on anything.

A variable can change. Its value varies, and that's why it's described as "variable". ' x ' is a variable. Its value depends on what ' x ' is.

User Breathe
by
8.2k points
7 votes

Answer:

A constant is a number that stays the same. A variable is number that doesn't remain the same.

User Andrea Del Bene
by
7.7k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.