What is A User Defined Data Type?




What is A User Defined Data Type?

The user defined data type enables a programmer to invent his/her own data type and define what values it can take on. This can help more listings more readable in the case of a complicated program or when more than one programmer works on it. Thus this data type can help a programmer reduce programming errors.

User-defined data types can be used like elementary data types or complex data types in the variable declaration of logic blocks (FC, FB, OB) or as a data type for variables in a data block (DB). You then have the advantage that you only need to define a special data structure once to be able to use it as many times as you wish and assign it any number of variables.

User-defined data types can be used as a template for creating data blocks with the same data structure, meaning you create the structure once and then create the required data blocks by simply assigning the user-defined data type (Example: Recipes: The structure of the data block is always the same, only the amounts used are different.)