Quantcast
Channel: Programming (In-game)
Viewing all articles
Browse latest Browse all 645

Possible Bug With Global Variables?

$
0
0
I'm not sure if this is a bug or not but when I run the following code by running the program block multiple times it keeps incrementing the global value.
Code:
int a=0;

public void Main(string argument) {
    a=a+1;
    Echo ("A:" + a);
}
If I run this the first time it will output:
A:1
Run it again it will say:
A:2

Is this meant to happen?

Viewing all articles
Browse latest Browse all 645

Trending Articles