Thanks! This works. func main() { var n int s := os.Args[1] n, err := strconv.Atoi(s) if err != nil {panic(err)}
On Thursday, February 13, 2025 at 5:23:10 PM UTC-5 Ian Lance Taylor wrote: > On Thu, Feb 13, 2025 at 2:12 PM Jabari Zakiya <jza...@gmail.com> wrote: > > > > I want to input an integer directly after the function > > > > $ ./myfunction n (CR) > > > > not > > > > $ ./myfunction (CR) > > n (CR) > > > > None of my search results explains how to do this. > > Sounds like you want to look at os.Args, which will contain the > arguments passed to your program on the command line. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/b35508d8-3335-4fdb-a09e-6bd9f6b4bd32n%40googlegroups.com.