Add files via upload
This commit is contained in:
4
go.mod
4
go.mod
@@ -1,3 +1,3 @@
|
|||||||
module example.com/investment-calculator
|
module example.com/structs
|
||||||
|
|
||||||
go 1.23.1
|
go 1.21.2
|
||||||
|
|||||||
22
structs.go
Normal file
22
structs.go
Normal file
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user