add: array exercises
This commit is contained in:
27
14-arrays/exercises/05-fix/main.go
Normal file
27
14-arrays/exercises/05-fix/main.go
Normal file
@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE: Fix
|
||||
//
|
||||
// 1. Uncomment the code
|
||||
// 2. And fix the problems
|
||||
// 3. BONUS: Simplify the code
|
||||
// ---------------------------------------------------------
|
||||
|
||||
func main() {
|
||||
// var names [3]string = [3]string{
|
||||
// "Einstein" "Shepard"
|
||||
// "Tesla"
|
||||
// }
|
||||
|
||||
// var books [5]string = [5]string{
|
||||
// "Kafka's Revenge",
|
||||
// "Stay Golden",
|
||||
// "",
|
||||
// "",
|
||||
// ""
|
||||
// }
|
||||
|
||||
// fmt.Printf("%q\n", names)
|
||||
// fmt.Printf("%q\n", books)
|
||||
}
|
11
14-arrays/exercises/05-fix/solution/main.go
Normal file
11
14-arrays/exercises/05-fix/solution/main.go
Normal file
@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
names := [...]string{"Einstein", "Shepard", "Tesla"}
|
||||
books := [5]string{"Kafka's Revenge", "Stay Golden"}
|
||||
|
||||
fmt.Printf("%q\n", names)
|
||||
fmt.Printf("%q\n", books)
|
||||
}
|
Reference in New Issue
Block a user