Commit 5cd525a

mo khan <mo.khan@gmail.com>
2019-10-19 22:03:27
Accept a parameter
1 parent 9b791a5
Changed files (2)
hello.go
@@ -2,10 +2,10 @@ package main
 
 import "fmt"
 
-func Hello() string {
-  return "Hello, world"
+func Hello(name string) string {
+  return "Hello, " + name
 }
 
 func main() {
-  fmt.Println(Hello())
+  fmt.Println(Hello("world"))
 }
hello_test.go
@@ -3,8 +3,8 @@ package main
 import "testing"
 
 func TestHello(t *testing.T) {
-  got := Hello()
-  want := "Hello, world"
+  got := Hello("mo")
+  want := "Hello, mo"
 
   if got != want {
     t.Errorf("got %q want %q", got, want)