Mel - Maya Embedded Language

<HOME>   <PREVIOUS>   <NEXT>

Variables

int
float
string
vector
array
matrix
Like any other programming language maya provides the user with the ability to temporarily store information through variables. An easy way to look at variables is to see them as a box that we dump and pull information into and from.

Declaring Variables

When declaring a variable there is a specific format you need to use. first declare what sort of variable you are using. If you do not declare what sort of variable you are using Maya will automaticly assign what sort of variable it is. Next use a $ sign followed by the name. There are a few restrictions on naming. You can not start with a number, you can not have whitespaces, or special characters. You can however put a number in the name after the first character.
int $myInt = 1;

string $myString = "Hello Jello";

Notice that after every variable I put a semicolon. It is important to remember to place a semicolon after every command. This is how maya knows when one command starts and another begins.

If you are unsure what a variable type is use the whatIs command to find out.

int $myInt = 1;
whatIs "$myInt";
// Result: int variable //