func (r *InclusiveRange) Value(idx int) (int, error) {
	if idx < 0 {
		return 0, fmt.Errorf("Index %d is not >= 0", idx)
	}

	// Calculate the value as an offset from the start
	start := r.Start()
	end := r.End()
	step := r.Step()

	val := start + (step * idx)

	if start <= end && (val < start || val > end) {
		return 0, fmt.Errorf("Index %d exceeds max index of %d", idx, r.Len()-1)

	} else if end < start && (val > start || val < end) {
		return 0, fmt.Errorf("Index %d exceeds max index of %d", idx, r.Len()-1)
	}

	return val, nil
}
func (r *InclusiveRange) Value(idx int) (int, error) {
	if idx < 0 {
		return 0, fmt.Errorf("Index %d is not >= 0", idx)
	}

	
	start := r.Start()
	end := r.End()
	step := r.Step()

	val := start + (step * idx)

	if start <= end && (val < start || val > end) {
		return 0, fmt.Errorf("Index %d exceeds max index of %d", idx, r.Len()-1)

	} else if end < start && (val > start || val < end) {
		return 0, fmt.Errorf("Index %d exceeds max index of %d", idx, r.Len()-1)
	}

	return val, nil
}
func ( r * InclusiveRange ) Value ( idx int ) ( int , error ) { if idx < 0 { return 0 , fmt . Errorf ( " " , idx ) } // Calculate the value as an offset from the start start := r . Start ( ) end := r . End ( ) step := r . Step ( ) val := start + ( step * idx ) if start <= end && ( val < start || val > end ) { return 0 , fmt . Errorf ( " " , idx , r . Len ( ) - 1 ) } else if end < start && ( val > start || val < end ) { return 0 , fmt . Errorf ( " " , idx , r . Len ( ) - 1 ) } return val , nil }
// Value returns the value at the given index in
// the range. If the index is invalid/exceeds the valid
// range, an error will be returned.
Value returns the value at the given index in the range . If the index is invalid / exceeds the valid range an error will be returned .