blob: 665e52a5f3580dd0e558b44ff069ee7b0803350e [file] [log] [blame]
Brad Fitzpatricke014cf02012-02-24 13:17:26 +11001// cmpout
Ken Thompson7d4b1e42010-03-02 18:32:11 -08002
Ken Thompsonf229c8b2010-03-09 12:49:24 -08003// Copyright 2010 The Go Authors. All rights reserved.
Ken Thompson7d4b1e42010-03-02 18:32:11 -08004// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
Rob Pikeeb37b5b2012-02-24 16:24:24 +11007// Test trivial, bootstrap-level complex numbers, including printing.
8
Ken Thompson7d4b1e42010-03-02 18:32:11 -08009package main
10
11const (
12 R = 5
13 I = 6i
14
15 C1 = R + I // ADD(5,6)
16)
17
Russ Coxf2b5a072011-01-19 23:09:00 -050018func doprint(c complex128) { println(c) }
Ken Thompson7d4b1e42010-03-02 18:32:11 -080019
20func main() {
21
22 // constants
23 println(C1)
24 doprint(C1)
25
26 // variables
27 c1 := C1
28 println(c1)
29 doprint(c1)
30}