]> Cypherpunks.ru repositories - gostls13.git/blob - test/varinit.go
The scope rules have been clarified to indicate that a
[gostls13.git] / test / varinit.go
1 // $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG wrong result
2
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package main
8
9 func main() {
10    var x int = 1;
11    if x != 1 { panic("found ", x, ", expected 1\n"); }
12    {
13            var x int = x + 1;
14            if x != 2 { panic("found ", x, ", expected 2\n"); }
15    }
16    {
17            x := x + 1;
18            if x != 2 { panic("found ", x, ", expected 2\n"); }
19    }
20 }