Monday, November 28, 2022
HomeGolangToo many return values - Getting Assist

Too many return values – Getting Assist


I’m a beginner gopher and I’ve exhausted myself making an attempt to unravel the “too many return values” thriller. See code beneath. Any assist a lot appreciated. (go model go1.19 home windows/amd64 Home windows 10)

bundle most important

import “fmt”

func most important() {
fmt.Println(Hellx())
}

func Hellx() {
abc := “hi there from depx”
return abc
}


./prog.go:6:14: Hellx() (no worth) used as worth
./prog.go:11:9: too many return values
have (string)
need ()

Go construct failed.

The Hellx operate doesn’t have a declared return kind, nonetheless you attempt to return a worth. As abc appears to be string, the right can be to make use of the string return kind.

duh! Like I mentioned, “I’m a beginner.” Thanks for taking the time to make this a “educating second.” :slight_smile:

This matter was robotically closed 90 days after the final reply. New replies are now not allowed.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments