mirror of
https://github.com/golang/go
synced 2024-11-22 17:44:46 -07:00
ab34d15f69
update run to work with multiple directories SVN=121485
50 lines
694 B
Go
50 lines
694 B
Go
// $G $D/$F.go && $L $F.$A && ./$A.out
|
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
var b[10] float;
|
|
|
|
func
|
|
main()
|
|
{
|
|
var a[10] float;
|
|
|
|
for i:=short(5); i<10; i=i+1 {
|
|
a[i] = float(i);
|
|
}
|
|
|
|
s := float(0);
|
|
for i:=5; i<10; i=i+1 {
|
|
s = s + a[i];
|
|
}
|
|
|
|
if s != 35 { panic s; }
|
|
|
|
for i:=short(5); i<10; i=i+1 {
|
|
b[i] = float(i);
|
|
}
|
|
|
|
s := float(0);
|
|
for i:=5; i<10; i=i+1 {
|
|
s = s + b[i];
|
|
}
|
|
|
|
if s != 35 { panic s; }
|
|
|
|
b := new([100]int);
|
|
for i:=0; i<100; i=i+1 {
|
|
b[i] = i;
|
|
}
|
|
|
|
s := 0;
|
|
for i:=0; i<100; i=i+1 {
|
|
s = s+b[i];
|
|
}
|
|
|
|
if s != 4950 { panic s; }
|
|
}
|