In most programming languages, not just VBA, variables are a useful tool to use.
It seems that many people suffer from not being able to understand this concept at the moment.
In books and the like, it is often explained using a box as a metaphor, but there are many people who say that it still does not make sense.
I also don’t think the box is a very good analogy.
But is there another better analogy? If asked, I could not answer clearly.
Somehow, I had been moaning about this for a long time.
Therefore, I would like to try to explain in my own way in an easy-to-understand manner.
How easy is it to understand??? But hang on.
Let’s compare the variable to fish called by different names as they grow larger.
Let’s take yellowtail as an example to understand clearly.
yellowtail gives its scientific name Seriola quinqueradiata.
Let this be the variable i. (It doesn’t matter if it’s i or j or whatever, just think of it as a variable)
For example, consider For i = 1 to 4.
Yellowtail is called differently depending on age, size, and region,
Both scientific names remain Seriola quinqueradiata.
This is equivalent to saying that the declared variable remains in i forever.
However, the number in i changes to 1,2,3,4 each time the loop is stacked.
Yellowtail also remains the same as its scientific name , Seriola quinqueradiata.
When It was young and small, called inada, hamachi, and warasa, but when It grew up, became yellowtail.
Inada is against 1, hamachi is opposed to 2,
Try applying Warasa to 3 and Yellowtail to 4.
Isn’t that a little easier to understand?
The scientific name doesn’t change, but the called name, the look, and the taste change.
In the first place, a concept is not so much a truth as it is
If you rationalize it that way, it is difficult to collapse the theory when the idea extends to other places,
I think that’s the idea.