ir
func sqrt(x float64) string {
if x < 0 {
return sqrt(-x) + "i"
}
return fmt.Sprint(math.Sqrt(x))
}
func main() {
fmt.Println(sqrt(2), sqrt(-4))
}
DevLorenzo
func sqrt(x float64) string {
if x < 0 {
return sqrt(-x) + "i"
}
return fmt.Sprint(math.Sqrt(x))
}
func main() {
fmt.Println(sqrt(2), sqrt(-4))
}
if num < 0 {
fmt.Println(num, "is negative")
} else if num < 10 {
fmt.Println(num, "has 1 digit")
} else {
fmt.Println(num, "has multiple digits")
}
}
package main
import "fmt"
func main() {
name := "Manager"
if name == "Manager" {
fmt.Println("This is the Manager")
} else {
fmt.Println("This is not the manager")
}
}
if _, err := doThing(); err != nil {
fmt.Println("Uh oh")
}