1

hi all:
i have a question in bgt, take this example:

class enemy
{
int speed;
enemy(int speed) {
this.speed = speed;
}
}
void add_enemy([email protected] entry) {
//here my question goes
//what is the diference between
@board[5] = @entry;
//and
@board[5] = entry;
}

the two codes are working well for me as the same.

thanks

Thumbs up

2

I'm not sure if there's a difference. I generally use the [ a-t ] on both sides only when comparing (ex, if(@[email protected]).). I think BGT tries to make the right side match the left—you'll notice that the compiler gives a warning instead of an error if you type if(@a==b).
The two cases where it's most important are the first side of an assignment (otherwise it will look for an opAssign method), and in dictionaries (if you don't use the [ a-t ] when storing an object like this in a dictionary, you'll get a null pointer Runtime error).
But, I'm not sure if there's a difference between @a=b, and @[email protected]

Some of my games
Keep up to date by following @Jeqofire on twitter!
Ear Ninja?

Thumbs up