In Go, which loop is used to iterate over elements in an array, slice, string, or map?
- for loop
- foreach loop
- range loop
- while loop
The range loop in Go is used to iterate over elements in an array, slice, string, or map. It provides a concise syntax for iterating over collections and is commonly used in Go for such purposes.
Loading...
Related Quiz
- Which part of the HTTP request lifecycle is typically modified or intercepted by middleware?
- What keyword is used to declare a variable in Go?
- How can you handle custom JSON marshaling and unmarshaling logic in Go?
- What are some best practices for interpreting and utilizing code coverage results effectively?
- Type assertion in Go is performed using the syntax _______.