The _______ keyword in Go is used to iterate over the key-value pairs in a map.

  • For
  • Iterate
  • Loop
  • Range
The 'range' keyword in Go is used to iterate over the key-value pairs in a map. It allows you to loop over each element in a collection, such as an array, slice, or map. When used with a map, 'range' iterates over each key-value pair, providing the key and the corresponding value in each iteration. This enables you to perform operations on each key-value pair or access the values stored in the map. The 'range' keyword simplifies the process of iterating over collections in Go and is commonly used in conjunction with maps to process their contents efficiently.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *