The concept of different types of variables allows a first (“coarse”) typification of variables (control or iconic data), whereas the actual type of the data (e.g., real, integer, string, etc.) is undefined until the variable gets assigned with a concrete value. Therefore, it is possible that the data type of a new data item differs from that of the old.
In HDevelop the type of a variable is defined in three different ways:
Of these three possibilities, procedure parameter definitions is the most potent one and will overrule the two others in any case, followed by global variable declarations. Therefore, usage in the code is the least potent one. In the latter case the type of a variable is defined by those code lines, and by those lines only, where the value of the variable is written and where the exact type of the new value is known a priori (i.e., before run time).
Within its scope a variable must always have the same type (control, iconic) and the same dimension, otherwise this will cause an error: