Is var short for variable?


(Cherolyn Lexvold) #1

Thus far, var sounds interesting, but mysterious


(Carolyn Van Slyck) #2

haha, yes var is the reserved keyword for variable. Similarly const is for constant.


(Cherolyn Lexvold) #3

Thanks Carolyn :blush:


(J Ohn Stuart) #4

yes, here is a nice example for the var keyword: https://tour.golang.org/basics/8


(Cherolyn Lexvold) #5

So why do we get “false false false”


(Norbert Melzer) #6

Because false is the zero value for bool.


(Cherolyn Lexvold) #7

Intriguing


(Norbert Melzer) #8

No, it’s documented as such in the language specifications:

https://golang.org/ref/spec#The_zero_value


(Cherolyn Lexvold) #9

When I said intriguing, that meant I was interested, but a little lost. Your answer however was helpful. Don’t worry, I’ll get there