On Sun, Jan 12, 2020 at 10:10 AM Silvan Jegen <s.je...@gmail.com> wrote:

> So the declaration of the variables in the for loop itself is in outer
> scope compared to the body of the for loop?

The outer scope begins immediately after the keyword "for". The inner
one is an ordinary block scope and it begins immediately after the
'{'.

> In that case, redeclaring them
> in the inner scope (== the loop body) would not be allowed either, no?

This is valid: { a := 42; f(a) { a := 24; f(a) }}

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-VfV6GSBs9EapNnezdC_GZ15ENYrE9VTWFBNkn6DZgJVA%40mail.gmail.com.

Reply via email to