On Sep 17, 12:49 am, "David A. Black" <dbl...@rubypal.com> wrote:
>
> No, because there's no such variable in scope. The second time through
> the loop, there's no assignment to a, and the first variable a has
> gone out of scope. So the only thing that "a" could mean, outside of
> an assignment, is the method a.
wow... i thought the "a" variable is kind of like in C or Python:
for (i = 1; i <= 2; i++) {
int a;
if (i==2) {
...
} else {
...
}
}
so that the "a" exists all inside the for loop... maybe that's not
right.
now, we can view the variable "a" as existing in the else block but no
where else in the original Ruby code?
--
Posted via
http://www.ruby-forum.com/.