Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Measurement Matters - Public vs. Dim


jra Jul 8, 2014 02:12 PM

Q: When should I use the Dim variable declaration instead of Public?

A: Dim and Public variables are temporary holding locations for values that normally vary during program execution. These values are typically the result of measurements and processing or calculations.

The main difference between a Dim and a Public variable is that Dim variables do not show up in the Public table. Your program can still write to, read from, and store data from Dim variables.

In general, during program development you can’t go wrong declaring all variables as Public; that way you can monitor the Public table while testing and see exactly what’s going on. Once your program is running as designed you can clean up the Public table by using the Dim declaration for variables you don’t need to monitor as closely. Often times I’ll use Dim variables for scratch calculations, loop counters, and when the Public table gets very large.

Tip: Variable names, both Dim and Public, are not case sensitive.

Next week: When should I use the Constant declaration?

* Last updated by: Janet on 7/8/2014 @ 8:27 AM *

Log in or register to post/reply in the forum.