#HELP with returning value of function
35 messages · Page 1 of 1 (latest)
But i want all the values inside of the returned array (inside initials)
if you have an array of strings, you can use strings.Join to make them into one string
and then printing that is easier
but how would i be able
or you can use %v in your fmt.Printf format string to just "stringify" anything you pass in
to display the returned value
fmt.Printf prints to the stdout
should i type initial_decide in the place of xxxx?
What i dont understand is, how do i print out the value's of the array, what should i put instead of the xxxx
Println takes a variadic response, so you could pass that in as a second parameter
fmt.Println("foo", myvar)
func main() {
naam_splitsen()
initial_decide(naam_splitsen())
fmt.Printf("Your initials are: ", initial_decide() )
}
this doesnt work
Because initial_decide takes an argument
yeah but it also returns something
You could capture the return value and put it in the print
myvar := myfunc()
These should all be in the tour, which I highly recommend if you haven't done it 🙂
but im giving it naam_splitsen[]
oh i get it..
but i dont thin
k
it will work
i fixed it
func main() {
test := initial_decide(naam_splitsen())
fmt.Println("Your initials are: ", test)
}
this worked for me
@thick patrol thanks alot!
I will do the go tour but i need to finish this first
@thick patrol i also got 1 more question
🥳