It is useful for things that you don't need to redefine, and you may need to use to compute different things (such that you have different modules/functions to compute each one of these things).
<h3><u>
What is a public variable?</u></h3>
A public variable is a variable that any function, sub procedure, or module can access without restriction.
Thus, if you want to define a variable only once and be able to call it from different functions or modules when you need it, you would want to make it a public variable.
An example with speed is:
You can make a simple code that for an initial speed computes the position vs time graph.
But you may want to expand that program, let's say that you make a module that also allows you to find the momentum or something like that (where you also need to use the speed).
Then defining the speed as public, is useful, as you can only call it with the module or function that you use to find the momentum.
Another example, maybe more complete.
Assume that you work with radiation physics. You define a mean energy of radiation (this would be the energy of the x-rays for example).
Now if you define that variable as public, you could use it for a lot of modules to compute a lot of different things, like fluency, kermas, etc.
Things that are really complex to compute and you may have the codes for each one in different modules/functions.
So it is really useful when you already had several codes that work with the same variable.
If you want to learn more about variables, you can read:
brainly.com/question/15683939