Standard library / flag

flag.Uint()

Registers a flag on the default command line. Unsigned machine-width integer; negative values are invalid. Run with arguments: ["-x=7"]. Expected stdout: '7\n'.

Formal Syntax & Structure

go syntaxgo
func Uint(name string, value uint, usage string) *uint

Parameters & Attributes

NameTypeDescription
namestringName of the flag or flag set.
valueuintDefault value for registration, or text to parse for Set.
usagestringHelp text describing the flag.

Return Value

*uint

Registers a flag on the default command line.

Working Example

Example Snippetgo
package main
import (  "flag"  "fmt")
func main() { v := flag.Uint("x", 3, "value"); flag.Parse(); fmt.Println(*v) }
Go Reference