### 2.8 Data types and assignments

The previous ﬁve sections describe the ﬁve data types used by BayES:

1. matrices

2. datasets

3. models

4. structures

5. strings

When using assignment statements, BayES infers the type of the item deﬁned from the right-hand side expression. For example, the statement:

s = "Hello from BayES!";

deﬁnes a string with id value s and assigns the value "Hello from BayES!" to it. The user does not have to declare s as a string before assigning a value to it: BayES infers that s is a string because the right-hand side expression, "Hello from BayES!", is a string. All functions that operate on strings can be used on s.

Suppose that a subsequent statement in the same script is:

s = [3;2];

This statement redeﬁnes s as a $2\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector and all functions that operate on matrices can be used with s. Furthermore, BayES deletes the value that s had when it was a string from memory without issuing any error or warning. This means that the same id value can be used in a script to represent diﬀerent data types at diﬀerent points. At every point, however, an id value can be associated with a single data type and previous deﬁnitions are cleared from memory.