What happens to return value from goroutine

前端 未结 5 1705
心在旅途
心在旅途 2021-01-12 00:45

Could someone please give clarification values returned from the goroutine. Does the returned value from the goroutine is getting stored on stake.

example :

5条回答
  •  执念已碎
    2021-01-12 01:28

    FYI: if you try to assign function result to var, like this:

    res := go printNumber(i)
    

    you'll get syntax error like this:

    prog.go:4:7: syntax error: unexpected go, expecting expression
    

    you can check it out here.

提交回复
热议问题