Both are incorrect (depending on what you’re trying to achieve):
- the first one is leaving scope after one (the first) element only
- the second is only printing the last element (unless that’s what you want…)
If you want all elements:
Both are incorrect (depending on what you’re trying to achieve):
If you want all elements:
Can somebody please enlighten me as to why this just prints 0 over and over again?
Whereas this (correctly) prints 4:
This only happens in On Paint. Is there something about On Paint that doesn’t allow loops to work, or have I stumbled upon a bizarre bug?
Doh! I think I’m officially an idiot. I didn’t even notice that I had the loop body going through to the return node. No wonder it bailed out after the first iteration. Thanks for the help!