Home>
As the title
Is it possible to insert an associative array map intoslice?
Is it possible to return a map for the return blood of func?
I tried it myself
too many arguments in call to
I was angry.
func write_review () {
fmt.Println ("title depression")
reviews: = map [string] string {}
reviews ["title"] = input ()
fmt.Println ("genre depression")
reviews ["genre"] = input ()
fmt.Println ("Depression")
reviews ["review"] = input ()
fmt.Println (reviews)
fmt.Printf ("% T", reviews)
// return reviews or var sli = append (sli, reviews)
}
-
Answer # 1
Related articles
- i want to add a value to the slice and return it to main in go func of a different function from golang main
- how to use a colon in a go slice
- go language 方法 how to read and use a 2d slice of another file
- is it possible to return the return value of the method body from within the closure with swift?
- matplotlib - is it possible to specify the size of the figure without using pltfigure (figsize =)?
- postscript [ruby on rails] is it possible to specify a column of another model in attachment_image_tag?
- javascript - is it possible to specify the style for each bar of the bar chart in the material design version of google charts?
- go - resolution of too many arguments to return
- swift - is it possible to specify the rotation direction to restore the image rotated by cgaffinetransform?
- i want to know how to specify the own class in the return value of python method by type annotation
- i want to specify and retrieve the key of the cookie in golang
- pass go slice to a function that accepts variable-length arguments
- php - wp: is it possible to specify that the key of a custom field is "the key is unknown but the user has it"?
- isn't it possible to write "a: = 1" when writing package variables in go language?
- is it possible to specify the email address for the administrator in the wordpress mw wp form as the email address registered by
- [javascript/input type = "date"] is it possible to specify and restrict multiple dates that can be selected in the calendar?
- i want to solve the problem with the slice of go
- go - slice has one more capacity?
- i want to define a slice in golang template
Trends
Then you can return a map type value.
You can add a map type value to the slice by writing as above.