What Are Variables?

Variables are, simply stated, the contents of a temporary storage area in an application. This storage area holds information, usually inputted into the program by a user. In the previous examples, the values of the name attributes were variables.

For example, in a previous line of code you wrote, you defined an input field with the name attribute equal to username:

<input name="username" type="text" /> 

When users access this line of code in the application, they can input information. The application then saves this input information in a temporary storage area, using the name attribute as the name of the temporary storage area. In other words, a temporary storage area (a variable) called username holds the user’s inputted ...

Get WAP 2.0 Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.