Quidest?

Zero values and default values in Go

· Lorenzo Drumond

Variables that get declared but not assigned have a default value.

That default value depends on the type of the variable.

Each type in Go has a zero value; for int and any numeric type, the default value is 0.

Zero value for string is the empty string “”.

Booleans default to false.

References

Next -> shorthand-assignment-in-go

#programming #type #golang #zero #for_the_love_of_go #default #variables