From: Robert Klemme Date: 2005-01-21T02:31:00+09:00 Subject: Re: Confused about variable "declarations" "Mark Hubbart" schrieb im Newsbeitrag news:de63abca050120090877cc9971@mail.gmail.com... > On Thu, 20 Jan 2005 21:01:01 +0900, Graham Nicholls > wrote: > > No worries, and thanks, but I think that the problem was that offset is > > being set inside an iterator (they still confuse me - any pointers to a > > good explanation would be nice!), which means that it is out of scope > > outside the iterator. > > A short explanation: Blocks have a sort of "leaky scope", where > variables from outside the scope can leak in and out, but those that > are from the inside don't leak out. for example: While I completely agree with your explanation the word "leaky" strikes me as odd as it seems to suggest uncommon or defective behavior: it's very common in programming languages, that variables are visible in nested scopes but not surrounding scopes: public int foo() { int visible_in_whole_method = 0; { int visible_only_in_this_nested_scope = visible_in_whole_method + 1; } } Kind regards robert