views:

105

answers:

1

I was reading a blog post and saw a groovy snippet that looked lik

while ( entry = inputStream.nextEntry ) {
  // do something
}

In the while loop, is this groovy syntax that will cause the loop to break when entry is null?

+1  A: 

yes, but it will probably make the compiler complain about a possible accidental assignment. It would be better to write while ( (entry = inputStream.nextEntry )!=null) {}

ddyer
No complaint for the compiler though.
Jeff Storey