← BYTES
Go·Starter·Ref: 10.1.1

What does the := operator do in Go?

Have a question about this video? Mention reference 10.1.1 when you contact us.

a.It declares a constant
b.It declares and initializes a new variable, inferring its type
c.It compares two values for equality
d.It casts one type to another
The := short variable declaration both declares a new variable and assigns it an initial value in one step, with Go inferring the variable's type from the right-hand side -- it can only be used inside function bodies, not at package scope, where var must be used instead.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES1011#Go