نقل قول:
A variable is a place in your computer's memory (just like a container) that can be used to store numbers. Let's see a few lite-C examples:
var bullets = 7;
var health;
var lives = 3; // the player has 3 lives
These are a few short lines of code but we can use them to learn many new things:
1. Every variable must be defined before being used, using the keyword named var. If you write this line of code:
health = 100;
and you haven't defined the variable named health before using it, you will get an engine error message.
2. Any variable can receive an initial value at game start, but we aren't forced to do that when the initial value does not matter. Example:
var bullets = 7;
var lives = 3;
3. We can add our own comments to the code. Every time it encounters two slashes // the engine will ignore the words, expressions, symbols, etc that follow it. This way we can add useful comments to our code:
var car_speed; // the speed of the car that chases the player
// @%$%&^& Ha Ha Ha! %^&** I rule!
..........