From 78b8ebf5bf6e8d6fc5e150aaf9f1637cdc61db93 Mon Sep 17 00:00:00 2001 From: noahspannbauer Date: Mon, 21 Oct 2024 06:58:45 +0100 Subject: [PATCH] Add files via upload --- go.mod | 4 ++-- structs.go | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 structs.go diff --git a/go.mod b/go.mod index 8b5015c..77c852a 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module example.com/investment-calculator +module example.com/structs -go 1.23.1 +go 1.21.2 diff --git a/structs.go b/structs.go new file mode 100644 index 0000000..b9f5807 --- /dev/null +++ b/structs.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" +) + +func main() { + firstName := getUserData("Please enter your first name: ") + lastName := getUserData("Please enter your last name: ") + birthdate := getUserData("Please enter your birthdate (MM/DD/YYYY): ") + + // ... do something awesome with that gathered data! + + fmt.Println(firstName, lastName, birthdate) +} + +func getUserData(promptText string) string { + fmt.Print(promptText) + var value string + fmt.Scan(&value) + return value +}