Callback exercise...trying again https://play.golang.org/p/7AH5xa2w-2c

Of course. But you have all that you need. If on these step something not clear better do one step back and do it again. If task don’t go forward - split it. Forget about callback, write your function separately.

Welcome back!
Ok. Thanks. Trying.
For some reason, when I format https://play.golang.org/p/eLMByqpfbLt it puts spaces between 40, and 000 in 40,000. Why is it doing that! https://play.golang.org/p/-bFAmPjZxdq

Because Go doesn’t know about seperators in numbers. You have to write them as 40000 or 16000456123.

Some languages like ruby, elixir or rust do allow to use _ as a separator.

The , in go is used to separate expressions/variables in multivalue returns/assigns, so basically go thinks you want to have 40 for the first and 000 for the second part of the assignment, thats why on a “Run” you will see errors about missing variables in multi-assignment:

prog.go:15:4: assignment mismatch: 1 variable but 2 values
1 Like

Thanks!

https://play.golang.org/p/plBC82YeZoY
So now, what?

What are return your function and what it’s must return?

1 Like

Sorry that I’ve been out of the loop.
My dad passed away on Saturday night.
Mother’s Day was Sunday
My birthday was Monday
Lots of mixed emotions

This is the information I have concerning a return:

Returning a Func

You can return a func from a func . Here is what that looks like.

code :

I’ll put my attention on the last one, since I understand the rest. I also understand this one. I want to attempt to apply it.
https://play.golang.org/p/vW0IGeIAox

I’m a little lost.
What I want to do is start at 2019 at 40000 and then increase by 1000 each year and print that

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