Attributes
You can not only manipulate objects in MEL by using commands such as move and rotate but also by directly altering the various attributes of these objects, in the same direct way as you can do this in the Channel Box or the Attribute Editor.

Attribute names
When specifying an attribute, however, you cannot use the attribute names you normally see in the Channel Box, because these may contain spaces. Instead you can use the attribute long or short names (choose Channels → Channel Names in de Channel Box).
Furthermore, you must always combine the name of the attribute with the name of the object or node, in the form node.attribute.

Retrieving attribute values
You can retrieve the value of an attribute using the getAttr function. There are two alternative ways of writing this:

float $ypos = getAttr("pCube1.translateY");
float $ypos = `getAttr pCube1.translateY`;

Modifying attribute values
You can modify the value of an attribute using the setAttr command. Here too, there are two alternative ways of writing this

setAttr pCube1.translateY 15;
setAttr("pCube1.translateY", 10);

Custom attributes
You can also add your own attributes to an object, in order to store extra information with respect to the object (e.g., mass, speed or cost). When you create an attribute you must at least specify its name (long or short) and its type. This type is not exactly the same as the data type of a variable.

Attribute typePossible values
boolboolean values (0 or 1 or on or off)
longlong integers
shortshort integers (-32768 to +32767)
doubledouble precision floating-point numbers
"float"single precision floating-point numbers

addAttr -shortName gf -longName goForwards pCube1;
addAttr -ln vX -attributeType double;
addAttr -sn ms -ln mass -defaultValue 1.0 -minValue 0.001 -maxValue 10000;