Prev | Current Page 101 | Next

LordAlex Leon, Greg Goralski

"Foundation Flex for Designers"

At
their simplest, they contain only one value at time, but there are more complex variable types such as
arrays that can contain multiple values. We??™ll cover those a little further, but for the moment let??™s take
a closer look at simple variables.
We create a variable as shown in Figure 7-7.
The keyword var means we are creating a variable. You Figure 7-7. A simple variable
can name your variable whatever you like as long it follows
these requirements:
The name must not contain any spaces.
The first character must be a letter, underscore (_), or dollar sign ($).
Each subsequent character must be a letter, number, underscore, or dollar sign.
The instance name must be unique.
It is good practice to give variables meaningful names that help illustrate their purpose in your code.
You also need to define what type value your variable will be storing. To define the variable type,
append a colon after the variable name and enter the variable type, for example, string, number, or
int (for integer). In our example, we want to store integer values. Then you can assign a value to your
variable using the equal sign. Close the statement with a semicolon.
You can also assign the content of one variable to another, as shown in Figure 7-8.
Figure 7-8. Passing a variable by value
In programming lingo, we call this ???passing a variable by value.??? This means that even if you delete
myFirstVariable, it will not have an effect on mySecondVariable. More complex variables, such as
arrays, are passed by reference.


Pages:
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
Moloko Michal Jennifer Lopez teksty pl mapa Los Del Rio