Bug in for loop syntax?
Monkey Forums/Monkey Bug Reports/Bug in for loop syntax?| 
 | ||
| Function main:Int() Local item:= New Item For item.index = 0 Until 10 Print item.index Next End Class Item Field index:Int End This produces an error:  ATTENTION: Compilation error reported by Trans: Syntax error - expecting '='.  | 
| 
 | ||
| Looks like a bug to me. I usually don't change an object's field with counters, nevertheless it seems like a bug. | 
| 
 | ||
| Possibly this is intended (note the similar issue if you use a step value it can only be set at the start of iteration).  I'm not even certain if all target languages would support this.  From a pure programming point of view it seems okay, but an old-style programmer would throw his hands up in horror at the thought of putting a loop counter on the heap. | 
| 
 | ||
| Yeah it's an odd occasion to write code using the counter like this. It did however confuse me with the error message. Perhaps a clearer error message if this behaviour is not wanted? |