Re: problems with the scoping in eu4
- Posted by mattlewis (admin) Jan 07, 2011
- 2089 views
coconut said...
integer r=5 while r do integer i=0 printf(1,"%d, ",i) i+=1 r-=1 end while
Bill raise a strong point here.
What's the point of beeing able to declare a variable inside a loop construct if its value is reset at each loop cycle?
It would be better to forbid variable declaration inside loop as it was in version 3.x
It is what I suggest concerning variables declarations: a rollback to the situation of version 3.x
The point is to declare a variable that doesn't persist from loop to loop. I agree that his example doesn't make sense. This is a more sensible use case:
while r do sequence x = s[r] ... use x ... r -= 1 end while
Matt