Re: Feedback on ForStatement

"Milles, Eric (TR Technology) via dev" <dev-GSC0n/0aZo1d/SJB6HiN2Ni2O/[email protected]>
Newsgroups gmane.comp.lang.groovy.devel
Message-ID <PH7PR03MB7224DE8B9E28B87334D102348A66A@PH7PR03MB7224.namprd03.prod.outlook.com>
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.