Files
master_go_programming/Section9/76-3.go
2023-11-08 13:42:52 +01:00

43 lines
517 B
Go

/*
Coding Exercise #3
There are some errors in the following Go program. Try to identify the errors,
change the code, and run the program without errors.
package main
import "fmt"
func main() {
myArray := [3]float64{1.2, 5.6}
myArray[2] = 6
a := 10
myArray[0] = a
myArray[3] = 10.10
fmt.Println(myArray)
}
*/
package main
import "fmt"
func main() {
myArray := [3]float64{1.2, 5.6}
myArray[2] = 6
a := 10
myArray[0] = float64(a)
myArray[2] = 10.10
fmt.Println(myArray)
}