Variables vs Constants - Deepstash
Variables vs Constants

Variables vs Constants

mobile.twitter.com

9 ideas

·

203 reads

4

Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Machine Learning With Google

Discover 95 similar ideas in

It takes just

14 mins to read

Variables vs Constants

Variables vs Constants

Variables and Constants are mostly misunderstood in programming. Most of the time, most of the people read bad definitions on Constants. A thread on this.

8

83 reads

First of all, we need to understand the usage of both variables and constants. Variables are used to store values which can be changed in run time whereas constant cannot be changed.

{1/9}

8

20 reads

But some of the websites/people explain these two in the wrong way. Mostly the definition for constant would be "A constant is a variable that can't be changed in the program".

{2/9}

8

24 reads

It totally makes no sense. This statement states that a CONSTANT is a VARIABLE but it's value can't be changed. If CONSTANT is a VARIABLE then the value can be changed. A total collapse in the meaning.

{3/9}

8

12 reads

So, both "Variable" and "Constant" come under a concept called "Identifiers". As the name suggests, identifiers help us to identify a value which is stored in the memory with the help of a name. It's like a box which contains some values/information with a label attached.

{4/9}

8

11 reads

Say if you wanna store a number "42" in your program/code, you can assign it to an identifier. So that you can use it later in your program.

{5/9}

8

11 reads

If a value stored in an identifier which can be changed in the run time, it is called a "Variable". If it cannot be changed it is called a "Constant".

{6/9}

8

11 reads

<p>Values stored in memory can...

Values stored in memory can't be accessed without knowing the address. Since we can't remember addresses, we need some kind of label which points to that address. Something like a contact number saved in the phone. We can’t remember phone numbers, but we can remember names.

{8/9}

8

13 reads

Also Also identifiers can be function names, type names, class names, labels, etc.,can be function names, type names, class names, labels, etc.,

{9/9}

8

18 reads

CURATED BY

djhemath

A self-taught software developer, obsessed with product ideas. I love to sleep, travel, make music and meeting people in person.

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving & library

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Personalized recommendations

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates