The AGS4 compiler allows this:
Code: ags
I cannot say for sure if the example above will loop infinitely because I don't remember the exact piece of code that made me notice the issue, but I definitely got indices mistakes caused by the fact that the inner variable was silently taking the spot of the outer variable with the same name.
I'm not sure what's allowed and not allowed in terms of re-declaring variables in inner blocks. I'm just reporting it in case it's an oversight.
int x=0; // declare outside loop
while(x!=1) {
int x=0; // declare again inside loop, with same name
x=1;
}
I cannot say for sure if the example above will loop infinitely because I don't remember the exact piece of code that made me notice the issue, but I definitely got indices mistakes caused by the fact that the inner variable was silently taking the spot of the outer variable with the same name.
I'm not sure what's allowed and not allowed in terms of re-declaring variables in inner blocks. I'm just reporting it in case it's an oversight.