Files

30 lines
773 B
Go
Raw Permalink Normal View History

2019-10-30 19:34:44 +03:00
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
// For more tutorials : https://learngoprogramming.com
// In-person training : https://www.linkedin.com/in/inancgumus/
// Follow me on twitter: https://twitter.com/inancgumus
2019-03-04 20:30:18 +03:00
package api
var temps = []int{5, 10, 3, 25, 45, 80, 90}
2019-08-22 20:00:58 +03:00
// Read returns a slice of elements from the temps slice.
2019-03-04 20:30:18 +03:00
func Read(start, stop int) []int {
// ----------------------------------------
2019-08-22 20:00:58 +03:00
// RESTRICTIONS — ONLY ADD YOUR CODE IN THIS AREA
2019-03-04 20:30:18 +03:00
portion := temps[start:stop]
2019-08-22 20:00:58 +03:00
// RESTRICTIONS — ONLY ADD YOUR CODE IN THIS AREA
2019-03-04 20:30:18 +03:00
// ----------------------------------------
2019-08-22 20:00:58 +03:00
2019-03-04 20:30:18 +03:00
return portion
}
2019-08-22 20:00:58 +03:00
// All returns the temps slice
2019-03-04 20:30:18 +03:00
func All() []int {
return temps
}