You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Golang provides three syntaxes for the variable declaration:
The most comfortable way is foo := "foo" but with this syntax you probably makes mistakes like binary_address := []byte{0} (wallet.go:62) or s := "" (transaction.go:70).
Other way consists in using the keyword var to the memory allocation and waits for the compiler to infer the variable type from the right side of declaration: var foo = "foo". I think its better way that the first one because allows to the developer to allocate memory without occupying them.
The last way its an extended version of the second one that includes variable type: var foo string = "foo". This way forces the developer to write more code, but make it more legible (and it's my favorite way).
What do you think about it?
The text was updated successfully, but these errors were encountered:
Golang provides three syntaxes for the variable declaration:
The most comfortable way is
foo := "foo"
but with this syntax you probably makes mistakes likebinary_address := []byte{0}
(wallet.go:62) ors := ""
(transaction.go:70).Other way consists in using the keyword
var
to the memory allocation and waits for the compiler to infer the variable type from the right side of declaration:var foo = "foo"
. I think its better way that the first one because allows to the developer to allocate memory without occupying them.The last way its an extended version of the second one that includes variable type:
var foo string = "foo"
. This way forces the developer to write more code, but make it more legible (and it's my favorite way).What do you think about it?
The text was updated successfully, but these errors were encountered: