Syntax of functions...

I ask the following questions because though to you they might sound elementary, that’s exactly where I’m at. Before I began to study Go, I had absolutely no background in programming. So I know nothing about C or any other language. I just felt I had to say that.

So, in the code above, please tell me:

  1. What part is the receiver?
  2. What part are the parameters?
  3. What part are the returns?

I know what is the identifier and the code. I have learned something!

How often do you want to ask a question about the basic syntax of functions? We repeatedly told you to go and take the Go tour. Please do this now.

If after taking the tour you still want to ask a question like the one above, please ask a smart question.


Hi Cherolyn,

  1. There is no receiver. To have a receiver, you must have types with methods. You haven’t defined either of those in your program.

  2. “Parameter” is another name for “argument”. Someone may want to correct me on that and point out there is a difference, but to keep things simple, both words are used to describe the variables or literals that you put in parenthesis after the name of a function you are calling, like

    func myFunction(a, b, c)

In the above, a, b, and c are the parameters.

  1. return is a keyword in Go used for passing a value back from a function. In line 23 of your program, you wrote

    return fmt.Sprint("Hello from woo, ", st)

It might help you to study a little mathematics (algebra) so you can learn how functions are used in mathematics. That’s where programming languages get the idea. Almost everyone who learns programming has taken a course like that in school, so when they encounter functions in programming languages, it seems very simple and obvious.

To say it very quickly, a function is something that takes some values (arguments), does some kind of operation with them that results in another value, and then the value of that function, for those arguments, is that result.

Suppose you have a calculator with a square root key. You press 2 then the square root key, and 1.41421 appears in the display. The calculator took 2 as the argument, ran the square root function with that, and the result was 1.41421. This can be written as

y = sqrt(x)

So if x is 2, sqrt(2) produces y = 1.41421.

I hope that helps.

1 Like

I have taken this tour several times

Then you should be able to answer your question.

That does help and I need to study it a bit, which I will do now.
So in “func bar(s string)” s string is the argument, i.e. parameter?

I studied high school algebra many, many, many years ago. Sounds like a good suggestion.

For example, I don’t know what this means…on the top left of the page…and so it goes throughout the tour

You mean “Hello”?

Or what is it you do not know what it means on the top left of the page? Please be more explicit when asking questions, we can’t read your mind and you can’t read ours.

And since you are here for quite a while now, and still asking questions that are usually covered in the first 3 lectures and assumed to be understood after that, you really should either search for someone who teaches you go (or programming) in person. If you can’t, it might be better to search for another hobby.

But trying to learn by asking questions that are on a very basic level, often even just a link to the playground and no actual question, which causes us to ask back to you, which you do not answer then or only very late… That won’t work out well for you. You should try to take yourself a week or even two of guided fulltime learning programming. Or at least a course in a community college/evening school.

Sorry for the hard words, but I really think you won’t gain much by continuing as you did before.


Hi Cherolyn,

I have to agree with a lot of what Norbert wrote. You’ve been stuck at a very elementary level for several months, and you aren’t making the kind of progress that you need to become proficient within a reasonable time.

I keep thinking the educational resource you’ve been using isn’t the best one for you.

Everyone learns differently. Some people learn well from reading books or watching video, and other people learn more quickly by being shown something in person. With mathematics, it’s important to have a good teacher you relate to in just the right way. Maybe programming is similar. When I’m learning a new computer-related technology, I spend a large amount of time up front looking for the particular book, video, websites, or whatever, to make sure I have the optimal resource(s) lined up. That way, I don’t waste time studying with something that isn’t really effective.

I think you need to try different things and find something that really “clicks” for you.


I found that on the first page of the Tour of Go"

it might be better to search for another hobby

This could possibly be true, but I don’t think so; si I will continue

Thank you for your viewpoint. I however don’t think there is a time limit, except the end of my life, which hopefully won’t be for many years. I am hoping someday that this will result in a career, but I’m just taking it one step at a time.

I grieve that I don’t have more time to devote to programming, but at the moment, I have big time constraints. I’m attempting to carve out more time.

I keep thinking the educational resource you’ve been using isn’t the best one for you.

I feel it it very beneficial since it’s “at my pace”

You might be correct that "I think you need to try different things and find something that really “clicks” for you.

but I deeply love this path that I have chosen and will continue for now. Yes, I’m moving like a turtle, but that does not bother me. I’m sorry for any discomfort that it causes to anyone on this forum. For those people, you may ignore my posts. I WILL get answers somehow

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