Functions and receivers func ( r receiver)

Go Tour

Thank you for this. I have read this page several times today, and it’s getting more and more clear.

Thanks. I will get it! I know I’ve asked similar questions about identifiers previously. I guess I’m trying to be sure it holds true in every instance.

r is not an alias of receiver

But I thinks what he’s saying is that r is the name of the receiver. It is the name, correct?

Which I totally understand.

No one here tries to discourage you, we only try to find a path for you that suites you better.

Also the problem with most people met online is, that they might stop helping when they have the feeling that the person asking doesn’t seem to understand and asks the same stuff that has been answered a thousand times, again and again.

We do not want happen this to you.

Also your style of asking makes it sometimes hard to actually find your questions and/or statements between quotes that you do not mark properly as such. Also code, just copy/pasted into your prose is hard to follow, not only it is not marked as code, but also missing a paren here or a bracket there.

And even though your questions sometimes are hard to read or even understand, I’ll try to answer as good as I can, as even though I think there are better ways for you to learn, but not answering you will teach you even less…

In that example (func (r receiver)) r is the name of a variable which has type receiver (which again is the of a type). If though r is a receiver in the sense of a method is unknown, as you gave only parts of the declaration.

1 Like

I don’t know why this was so hard for me. Looks obvious now. Starting to know those terms

Thanks for your continual references to the tour. Specific pages are especially helpful

I guess I misunderstood this to be what the forum appreciates.

“I’ll try to answer as good as I can” you

Thanks!

Most appreciated are properly marked code blogs using tripple backticks:

```go
// your code here
```

Or alternatively a link to the playground, which you already did quite often for more complete programs and which I appreciate.

For shorter snippets in the flow of a sentence, you can use single-backticks to mark it as code, eg: `fmt.Println("Hello!")`.

1 Like

In https://tour.golang.org/basics/4, are 42 and 13 the arguments?

Yes, they are the arguments applied to the function add(), which result then is the argument to fmt.Println().

2 Likes

Thanks!

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