It would be convenient to be able to say something like:
for _, element := reverse range mySlice {
...
}
I guess this is the easiest way to reverse arrays.:
package main
import "fmt"
// how can we reverse write the array
func main() {
arr := [...]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
revArr := [len(arr)]int{} // making empty array for write reverse
for i := range arr {
revArr[len(arr)-1-i] = arr[i]
}
fmt.Println(revArr)
}
https://play.golang.org/p/QQhj26-FhtF