Let's say I have a function:
func foo() (bool, string) { ... }
And then I wish to declare two variables b
and s
, initialized with values returned by the function call foo()
. I'm aware I can do this using the "shorthand" syntax which omits type annotations:
b, s := foo();
However, I do not wish to use this shorthand syntax. I wish to use the var
syntax with a variable name and expected type. I have tried this:
var b bool, s string = foo();
However, this gives me a syntax error. What is the correct way to do this?