A data type describes what kind of information (such as text) can be stored in a variable or returned by a function. This in turn affects what can be done with that information. NWScript is a statically typed language, meaning that the data type of each variable must be known when the variable is declared, and data types are for the most part not interchangeable. (The exception is that sometimes there is an implicit conversion between the two numeric types—floating point and integer.)

The data type of a variable (or function) is specified as part of that variable's declaration, using a keyword before the variable name. For example,

string sMyString;

declares sMyString to be a variable of the "string" data type. The keywords recognized by NWScript are effect, float, int, itemproperty, location, object, string, and vector. In addition, there is a void keyword that cannot be used to declare a variable, but rather is used to declare a function as not returning data. Furthermore, the action keyword is used in (only) parameter declarations of commands to indicate a parameter that must be a function (or command) with a "void" return value.

See also Edit