All input and output fields in the Designer have a type. There are five basic types in Designer: Text, Number, True/False, Date&Time, and File.

When working with input fields and output fields, it’s important to be mindful of the types. The type system is what allows or prevents certain behaviors.

Text

A sequence of characters.

Examples:

Free Mars, Hello, World!, 12345

You can also have a single space (length 1) or frequently a text input or output may be empty (length is 0).

Number

An integer or decimal.

Examples:

12345, 1, -10, 0.543

True/False

These inputs always have one of two values: either true or false.

If you send a True/False output to a text input, it will convert to the word “true” or the word “false”. If you send text output to a True/False input, any word other than “false” converts to true. If you send a number, then any value other than zero converts to true.

Special Types

Beyond these basic types, there are also two special types, List and Object. These types are composites of the other types.

A list is a collection of items all of the same type. An object is a collection of keys and values, where each value is of a certain type. Unlike lists, objects can contain values of many different types.

A list has the structure:

[ 'nitrogen', 'oxygen', 'argon' ],

where ‘nitrogen’, ‘oxygen’, and ‘argon’ represent three text items in a list.

An object has the structure:

{“lastName”: “Russell”, “firstName”: “Saxifrage”}

In the above example, “lastName” and “firstName” are the keys in the object. The corresponding values are “Russell” and “Saxifrage”.

Items in a list are often represented as contained between brackets []. Similarly, you can distinguish an object by its use of curly braces {}.

The Right Types

Type mismatches occur when the Designer expects a certain type but does not receive it. Most of the time, the Designer will prevent you from making these sorts of errors. However, they can occur with more advanced use of the Designer, so it’s important to be mindful of the overall type system.

Both input fields and output fields have a type. However, input fields and output fields each handle types differently.

Types - Input Fields

For an input field, if a certain type is specified, the card will try to automatically convert an incoming value to that type. For example, if you were to pass the text 1/1/18 as an input to a field that was set to the type Date & Time, the card will automatically convert this value to the appropriate type.

Types - Output Fields

Output fields, however, behave differently. Output fields expect you, the user, to be honest about what they are. If you specify that an output field is of the type “Text”, the Designer will expect that the value contained within this output field is text. In the circumstance that the output field value does not match its type, a type conversion error will be thrown.

Many of the available functions in the Designer already specify both the type of the input field and the output field and do not allow you to change these types. The Designer will often know what type both the inputs and outputs should be. In this circumstance, worrying about types is unnecessary.

However, in circumstances where the Designer doesn’t explicitly know either the input or the output field values, types play a large role.

Next: 04 - math and text // abc, it’s easy as 123