Source file test/ken/cplx0.go

     1  // run
     2  
     3  // Copyright 2010 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 trivial, bootstrap-level complex numbers, including printing.
     8  
     9  package main
    10  
    11  const (
    12  	R = 5
    13  	I = 6i
    14  
    15  	C1 = R + I // ADD(5,6)
    16  )
    17  
    18  func doprint(c complex128) { println(c) }
    19  
    20  func main() {
    21  
    22  	// constants
    23  	println(C1)
    24  	doprint(C1)
    25  
    26  	// variables
    27  	c1 := C1
    28  	println(c1)
    29  	doprint(c1)
    30  }
    31  

View as plain text