if 文はいたって普通。else if は elsif でも elif でもなく else if。
package main
import "fmt"
func isZero(n int) string {
if n > 0 {
return "More than zero."
} else if n < 0 {
return "Less than zero."
} else {
return "Just ZERO!"
}
}
func main() {
fmt.Println(isZero(3))
fmt.Println(isZero(-1))
fmt.Println(isZero(0))
}
^o^ > go run if.go More than zero. Less than zero. Just ZERO!