From 6c478968f9cdd45246704e70690345cd864fa78c Mon Sep 17 00:00:00 2001 From: "Dhasmana, Saksham" Date: Tue, 13 May 2025 22:29:44 +0530 Subject: [PATCH] string variables added --- hello.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hello.go b/hello.go index a3dd973..90172a2 100644 --- a/hello.go +++ b/hello.go @@ -4,4 +4,21 @@ import "fmt" func main() { fmt.Println("Hello, World!") + + // string variable + var name string + name = "John Doe" + fmt.Println("Hello, " + name + "!") + + lastname := "Brahmin" + fmt.Println("Latname: " + lastname) + + fmt.Printf("Name: %s, Lastname: %s\n", name, lastname) + // decimal variable + fmt.Printf(("Salary: %f\n"), 1000.23) + + fmt.Printf("Salary: %.2f\n", 1000.238) + + fmt.Printf("Age: %d\n", 25) + }