Re: Feedback on ForStatement
Jochen Theodorou <[email protected]>
| Newsgroups | gmane.comp.lang.groovy.devel |
|---|---|
| Message-ID | <[email protected]> |
On 06.02.26 17:30, Milles, Eric (TR Technology) via dev wrote: >> How does one distinguish between an absent value and a value of null > (e.g., as a list element)? > > In the current ForStatement: > > "for (i, x in y)" > getIndexVariable() returns i (or null if "i," is omitted) > getValueVariable() returns x > getCollectionExpression() returns y > > "for (int i = 0; i < n; ++i) ..." > getIndexVariable() returns null > getValueVariable() returns null > getCollectionExpression() returns a ClosureListExpression that contains > all of "int i = 0; i < n; ++i" — why it's called "closure list" must be > a legacy thing How does this all work if more than one variable is defined? bye Jochen