Bug #12748

uppercase variable problem in for loops

Added by T_D over 4 years ago. Updated over 4 years ago.

Status:Resolved Start date:08/06/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:1.0.0.43
Affected Version:

Description

Not really a bug but something to consider:
for "_I" from 0 to 45 do {
hint str _I;
}

Biki says that uppercase variables do not work here. (Guess who found that out ^^)
Tested it in VBS2 and it seems to be no problem there. Dunno what the current status is for ArmAII.

History

Updated by sbsmac over 4 years ago

Very interesting ! Will add a rule to check for this. I just checked it in A2 and could reproduce the bug...

_I=5;

for "_I" from 1 to do 2 {
player sidechat format ["%1",_I] ;
};
player sidechat format ["%1",_I] ;

produces 5,5,5. I suspect that BIS have forgotted to lower-case the new variable when creating it in context.

Even more interesting, you can get away with writing

g=5;

for "g" from 1 to do 2 {
player sidechat format ["%1",g] ;
};
player sidechat format ["%1",g] ;

which results in 1,2,5 ! Although I wouldn't recommend taking advantage of this 'feature' :-)

Updated by sbsmac over 4 years ago

  • Status changed from New to Resolved
  • Target version set to 1.0.0.43

Added rule to check for this in next version.

Also available in: Atom PDF