// main.go
package main
import (
"fmt"
)
// package level declaration.
var score = 99.5
func main() {
sayHello("mario")
for _, v := range points {
fmt.Println(v)
}
showScore()
}
// greetings.go
package main
import "fmt"
var points = []int{20, 90, 100, 45, 70}
func sayHello(s string) {
fmt.Println("hello", s)
}
func showScore() {
fmt.Println("you scored this many points:", score)
}
// 실행
//
// go run main.go greetings.go
//
// 결과
// hello mario
// 20
// 90
// 100
// 45
// 70
// you scored this many points: 99.5
댓글 영역