golang flag example

package main

import (
    "flag"
    "fmt"
)

func main() {
    // Declare variables to hold flag values
    var name string
    var age int
    var married bool

    // Define flags and assign values to variables
    flag.StringVar(&name, "name", "John Doe", "Specify the name")
    flag.IntVar(&age, "age", 30, "Specify the age")
    flag.BoolVar(&married, "married", false, "Specify marital status")

    // Parse command line arguments
    flag.Parse()

    // Display the values of the flags
    fmt.Println("Name:", name)
    fmt.Println("Age:", age)
    fmt.Println("Married:", married)
}