TypeDef (Type Definitions)

A Typedef declaration allows you to make a synonym or "alias" for another type. Typedef declarations do not introduce new types, but introduce new names for existing types.

To create a new TypeDef, start with adding a new Type. Its default Type is Struct. Change its name to the desired "alias", for example, "SecurityCode". On its property page, select the desired Type, for example, Long. On the list of Types, you will now see SecurityCode as a Type of data type Long.

Types

===============

SecurityCode: Long

You can now declare a new variable of data type "SecurityCode" and it will have the same data type of Long. For example, you can declare "TempSecCode" to be of type "SecurityCode":

TempSecCode: SecurityCode

In a similar manner, you can create a new Type named "Logical" to be of Type Bool. "Logical" is a TypeDef (alias) for Bool. New variables can be created of Type Logical, example, "PowerOn".

Such TypeDefs can be used to assign variables of one Type and change their Type later very easily, by reassigning the name to have a different data type. As long as your code does not object to the change in data types, it should function. Note: Some data conversion rules may cause problems with some data type changes. As a precaution against loops of one Type being made a TypeDef for another, which is a TypeDef for the first Type, ATEasy has a built in limit of 25 levels of aliases

See Also

Arrays, Enum, Struct