add: unfinished code. people are having problems

This commit is contained in:
Inanc Gumus
2018-11-13 17:43:25 +03:00
parent 67b20e5755
commit 490223331c
103 changed files with 4218 additions and 3 deletions

View File

@@ -0,0 +1,33 @@
package main
// STORY:
// Hipster's Love store publishes limited books
// twice a year.
//
// The number of books they publish is fixed at 4.
// So, let's create a 4 elements string array for the books.
const (
winter = 1
summer = 3
yearly = winter + summer
)
func main() {
// var books [4]string
// var books [1 + 3]string
var books [yearly]string
books[0] = "Kafka's Revenge"
books[1] = "Stay Golden"
books[2] = "Everythingship"
books[3] += books[0] + " 2nd Edition"
// Go compiler can catch indexing errors when constant is used
// books[4] = "Neverland"
// Go compiler cannot catch indexing errors when non-constant is used
// i := 4
// books[i] = "Neverland"
}