Jump to content

Range extraction: Difference between revisions

→‎{{header|Go}}: language change. built in error type.
(→‎Iterative: Insert the Iterative code specimen)
(→‎{{header|Go}}: language change. built in error type.)
Line 743:
 
import (
"oserrors"
"fmt"
"os"
"strconv"
"strings"
Line 763:
}
 
func rangeFormat(a []int) (string, os.Errorerror) {
if len(a) == 0 {
return "", nil
Line 784:
}
if a[n2] == a[n2-1] {
return "", oserrors.NewErrorNew(fmt.Sprintf(
"sequence repeats value %d", a[n2]))
}
if a[n2] < a[n2-1] {
return "", oserrors.NewErrorNew(fmt.Sprintf(
"sequence not ordered: %d < %d", a[n2], a[n2-1]))
}
1,707

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.