Files
learngo/16-slices/exercises/23-limit-the-backing-array-sharing/api/api.go
2019-08-22 20:04:52 +03:00

22 lines
465 B
Go

package api
var temps = []int{5, 10, 3, 25, 45, 80, 90}
// Read returns a slice of elements from the temps slice.
func Read(start, stop int) []int {
// ----------------------------------------
// RESTRICTIONS — ONLY ADD YOUR CODE IN THIS AREA
portion := temps[start:stop]
// RESTRICTIONS — ONLY ADD YOUR CODE IN THIS AREA
// ----------------------------------------
return portion
}
// All returns the temps slice
func All() []int {
return temps
}