Komag
11 years agoRoku Guru
FOR EACH bug - one iteration breaks another
I was diagnosing a game bug and came across this behavior, which seems like a bug to me.
The FOR EACH loop breaks! It never does blue!
Why would printing a break the larger loop? Why does iterating through a to print it break the overall iteration of a for the FOR EACH loop? Is that a bug or is that common/known behavior across many programming languages?
BrightScript Debugger> a = ["red", "blue"]
BrightScript Debugger> ? a
red
blue
BrightScript Debugger> for each col in a: ? "color " col: end for
color red
color blue
BrightScript Debugger> for each col in a: ? "color " col: ? "test " a: end for
color red
test red
blue
BrightScript Debugger>
The FOR EACH loop breaks! It never does blue!
Why would printing a break the larger loop? Why does iterating through a to print it break the overall iteration of a for the FOR EACH loop? Is that a bug or is that common/known behavior across many programming languages?