# : (type)

#### Availability

Flash Player 6.

#### Usage

    [modifiers] [var] variableName:[type]
    function functionName():[type] { ... }
    function functionName(parameter1[:type], ... , parameterN[:type]) { ... }

#### Parameters

`variableName` An identifier for a variable.

`type` A native data type, class name that you have defined, or interface name.

`functionName` An identifier for a function.

`parameter` An identifier for a function parameter.

#### Description

Operator; specifies the variable type, function return type, or function parameter type. When used in a variable declaration or assignment, this operator specifies the variable's type; when used in a function declaration or definition, this operator specifies the function's return type; when used with a function parameter in a function definition, this operator specifies the variable type expected for that parameter.

Types are a compile-time-only feature. All types are checked at compile time, and errors are generated when there is a mismatch. (For more information, see Error Messages.) Mismatches can occur during assignment operations, function calls, and class member dereferencing using the dot (`.`) operator. To avoid type mismatch errors, use explicit typing (see Strict typing of items).You can also harvest type information for use during development, debugging, and publishing of component metadata.

Available types are all native object types, all classes that you define, interfaces, and Void and Function (which exist only as types, not as objects). The recognized native types are Array, Boolean, Button, Color, CustomActions, Date, Function, LoadVars, LocalConnection, Microphone, MovieClip, NetConnection, NetStream, Number, Object, SharedObject, Sound, String, TextField, TextFormat, Video, Void, XML, XMLNode, and XMLSocket.

#### Example

Usage 1: The following example declares a public variable named `userName` whose type is `String` and assigns an empty string to it.

    public var userName:String = "";

Usage 2: This example demonstrates how to specify a a function's parameter type. The following code defines a function named `setDate` that takes a parameter named `currentDate` of type `Date`.

    function setDate(currentDate:Date) {
    	 this.date = currentDate;
    }

Usage 3: The following code defines a function named `squareRoot` that takes a parameter named `val` of the `Number` type and returns the square root of `val`, also a `Number` type.

    function squareRoot(val:Number):Number {
    	return Math.sqrt(val);
    }