3.6.1 Format a String or an Enumeration

Form functions takes the value of a variable and format it as a String. They can be invoked in expressions and are also used by Print, Trace, and Assert commands. You can write custom Form functions for structures.


If the first argument is a String and the template is an empty String then the default format ("C#") is used and the String is returned as is.

When the template String is an unsigned decimal constant the result is the first argument repeated that many times. The constant may not contain underscores and the limit is 255. It may also be quoted.

An enumeration declaration can either be a list of names or a range of integers. With names, it is in upper case and formatted as a String. Ranges are formatted using an integer template as described in the section on formatting integers.

Form Function

Format an Integer Number