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) *uintParameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Name of the flag or flag set. |
| value | uint | Default value for registration, or text to parse for Set. |
| usage | string | Help 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) }