# Void (compile-time only)

# Assigning data types to items

- Flash automatically assigns data types to the following kinds of items, as discussed in Automatic typing of items below:Variables
- Parameters passed to a function, method, or class
- Values returned from a function or method
- Objects created as subclasses of existing classes

However, you can also explicitly assign data types to items, which can help prevent or diagnose certain errors in your scripts. For more information, see Strict typing of items.

When you debug scripts, you may need to determine the data type of an expression or variable to understand why it is behaving a certain way. You can do this with the `typeof` operator (see Determining an item's data type).

## Automatic typing of items

In Flash, you do not need to explicitly define an item as holding either a number, a string, or other data type. Flash determines the data type of an item when it is assigned:

    var x = 3;

In the expression `var x = 3`, Flash evaluates the element on the right side of the operator and determines that it is of the number data type. A later assignment may change the type of `x`; for example, the statement `x = "hello"` changes the type of `x` to a string. A variable that hasn't been assigned a value has a type of `undefined`.

ActionScript converts data types automatically when an expression requires it. For example, when you pass a value to the `trace` action, `trace` automatically converts the value to a string and sends it to the Output window. In expressions with operators, ActionScript converts data types as needed; for example, when used with a string, the `+` operator expects the other operand to be a string:

    "Next in line, number " + 7

ActionScript converts the number 7 to the string `"7"` and adds it to the end of the first string, resulting in the following string:

    "Next in line, number 7"

You can convert one data type to another. To convert a string to a numerical value, use the `Number` function. To convert a numerical value to a string, use the `String` function. ActionScript DictionaryFor detailed information, see Number (function) and String (function).