Returning a string

In this code, https://play.golang.org/p/GzNV2-meQTb,
is “s” related to “s1” and if so, how?; and is there something in the code that clues you in to that?

No. The function foo returns a string which main prints. You can get rid of s and s1 without altering the program:

package main

import (
	"fmt"
)

func main() {
	fmt.Println(foo())
}

func foo() string {
	return "Hello world"
}

https://play.golang.org/p/EZ0HK36vG-g

Thanks!!! I love it when I understand something!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.