1
0
mirror of https://github.com/danog/liquid.git synced 2024-12-02 15:47:46 +01:00
liquid/values/range.go

18 lines
381 B
Go
Raw Normal View History

2017-07-28 00:11:37 +02:00
package values
// A Range is the range of integers from b to e inclusive.
type Range struct {
b, e int
}
// NewRange returns a new Range
func NewRange(b, e int) Range {
return Range{b, e}
}
// Len is in the iteration interface
func (r Range) Len() int { return r.e + 1 - r.b }
// Index is in the iteration interface
func (r Range) Index(i int) interface{} { return r.b + i }