What is the idiotic way to insert multiple returns values in Go?
Do you need to use it single line, or do you have to use the temporary variable as I did in the example below? Package main import "fmt" func oneRet () interface {} {returns "hello"} Func twoRet () (interface {}, error) {return "Hejsan", nil} func main () {// With a return value, you can just do this str1: = a reset (). (String) fmt.Println ("string1:" + str1) // It is not easy with two return values / str2, err: = twoRet (). (String) // is not possible / do I really have to use a floating variable? Temporary, err: = twoRet () str2: = temp. (String) fmt.Println ("string 2:" + str2) if mistake! = Nil {Terror ("without accessibility")}}
By the way, is it known as the You can not do this in a row By the way, is it called Casting while talking about the interface? It is actually called. One type casting as the interface?
i: = interface (Int)
var is an int var b int64 a = 5 b = int64 (a)
Comments
Post a Comment