In Go, the ErrRange
variable is a built-in variable of the strconv
package, which indicates that a given value is out of range for the target type. It takes no parameters.
*errors.errorString strconv.ErrRange
var ErrRange = errors.New("value out of range")
The return type of this variable is *errors.errorString
.
This variable returns the "value out of range"
string.
package mainimport ("fmt""strconv")func main() {//Display the return typefmt.Printf("The return type of strconv.ErrRange is %T\n", strconv.ErrRange)// Display the return valuefmt.Println("the return value of strconv.ErrRange:", strconv.ErrRange)}
Line 1: We add the main
package.
Lines 3–6: We import the other required packages.
Line 8: We define the main()
function.
Line 10: We print the return type of the strconv.ErrSyntax
variable.
Line 12: We print the return value of the strconv.ErrSyntax
variable.