Source file test/ken/simpvar.go

     1  // run
     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  // Test scoping of variables.
     8  
     9  
    10  package main
    11  
    12  var	x,y	int;
    13  
    14  func
    15  main() {
    16  
    17  	x = 15;
    18  	y = 20;
    19  	{
    20  		var x int;
    21  		x = 25;
    22  		y = 25;
    23  		_ = x;
    24  	}
    25  	x = x+y;
    26  	if(x != 40) { panic(x); }
    27  }
    28  

View as plain text