XNA Meeting point

Multi language XNA tutorials meeting point

Accueil
English
Français
Español
Archive
Storage
Stockage
Almacenamiento
Shaders : tutorial 1
Shaders : tutorial 1
Shaders : tutorial 2
Shaders : tutorial 2
Shaders : tutorial1
C# : Tutorial 1
Shaders : tutorial 2
Shaders : tutorial 3
Shaders : tutorial 4
Shaders : tutorial 5
Shaders : tutorial 6
Shaders : tutorial 7
Shaders : tutorial 3
Physics : tutorial 1
Search
C# : Tutorial 1
by A.Nadif

 

I Variables
 
First thing to know is that variables are memory slots. To actually create the variable, you need to allocate memory, i.e. you have to declare it. When declaring, you need to specify the datatype. Indeed, if you allocate memory, it is so as to store data. So, you must tell what kind of data it is (e.g. integer, float, double,...). The name of the variable, the one you'll be using to refer to this variable, is called the label. Then, you'll need to assign some value to the variable, that means that you will store this value in memory, and if you want to use it, you will need to use the variable label.
 
A varible must be assigned ! If you will be using the variable later, the best thing to do is to give it a first value that will change later. The first assignment is called the initialization of the variable.
 
A variable doesn't "live" forever. Indeed, it depends on where you declared it. For example, if you declare a global variable, that means that you declare it on the top of a class. It will "live" from the begining of the class to its end. It will exists in each and every method of the class. If you declare it inside a method, it'll be destroyed as soon as the method ends. This is called the scope of the variable.
 
II Methods
 
a
 
III Classes
 
a
 
IV Other stuffs