Web Design Specialists.
algebra. Variables in algebra are values that are identified by a letter. In Example
(x=y+2), x and y are the variables. You can see that the values of x and y can change depending
on which values you choose. If you set y to equal 4, then x=6.
iPhone 3G & iPod touch Accessory and Software Sale - UP TO 39% OFF + BIG Shipping Discounts
In programming, a variable is simply a name or identifier of a location in computer
memory. You may assign the variable a value or it may change over a period of time. When
naming your variables, you may choose a character, a word, or a combination of characters,
numbers, and the underscore (_). Your variable name must, however, begin with a letter or
you may have a variable named 'Amount' and a variable named 'amount' and your browser will not
confuse the two variables. When naming variables, it is a good practice to give them meaningful names,
which reflects the item it holds. So, a variable that holds the unit price of an item bought,
might be called 'unit_price.'
Before you can use any variable in your program, you must first declare it. By declaring it, you are allocating space in the computer's memory so that only this one variable will have access to that space. In declareing variables, use the following format.
Variables may hold numbers or strings. A string is a series of characters, numbers, and spaces. In the following examples we have code for declaring different datatypes.
Arithmetic operators take two numeric values called operands and results in one final number.
Arithmetic operators are:
Comparison operators take two operands and returns a true or false. Comparison operators are:
Boolean operators take two operators and returns a true or false. Boolean operators are:
Strings use the string operator + to concatenate strings together.
If then else