Variables and Data Types
From GPWiki
The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server. However, the GPWiki forums are still active! Come say hello. Ready for the harder stuff? In any application, the data such as the player's stats, the high scores, the rpg character's magic powers, and amongst a bundle of other things, must be stored in memory. Memory is stored in little things known as "variables". Variables are very important and are found in every program. [edit] VariablesThere are many types of variables:
There are three ways to create and initialize variables. Using the let or dim commands, or simply creating the variable. A variable must begin with a letter or underscore, cannot include math operators and cannot be the name of a command. dim myString = "my first string" or let myString = "my second string" or simply myString = "my third string!" Variables that are integers do not need double quotes. [edit] ArraysAn array is a matrix consisting of numerical numbers that represent variables. Basically, they are memory locations that are used to record data that are similar. For example, let's say that you are recording team names in baseball. You could create an array that has the numeric labels 0 to 49. The variables that are created with the array are strings that contain the names. These variables are not restricted to strings; they may hold numbers too. To create an array, you must do the following: dim baseball_teams |


