3 ms·
What do you mean by 'does not work'? Your second example will work but the x declared in the if statement will be local to that statement (note not to the block
by jgrahamc 14y ago
What do you mean by 'does not work'? Your second example will work but the x declared in the if statement will be local to that statement (note not to the block but the entire statement).
In both cases you have redeclared x. In the second the scope is different.
See: http://play.golang.org/p/c9B-FXL0Fw http://play.golang.org/p/c9B-FXL0Fw