Skip to content

Commit 3c9b9e8

Browse files
committed
adds comments
1 parent 72f501a commit 3c9b9e8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

codes/ch2_functions/function-n-return.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,20 @@ func CreateMessage(name, username, message string) (string, string) {
3030
* Define a Greeting function;
3131
*/
3232
func Greeting(github Profile) {
33+
34+
3335
welcome, info := CreateMessage(github.name, github.username, github.message)
3436

35-
fmt.Println(welcome) // Commenting this line would throw an error "welcome declared and not used"
37+
/**
38+
* Commenting exact below "Println(welcome) line would throw an error "welcome declared and not used"
39+
* In case you want to ignore the welcome declaration and use info => replace welcome with _ as below syntax
40+
*
41+
* E.g. _, info := CreateMessage(github.name, github.username, github.message)
42+
*/
43+
fmt.Println(welcome)
3644
fmt.Println(info)
45+
46+
// fmt.Println(_) // Cannot use _ as value
3747
}
3848

3949
func main() {

0 commit comments

Comments
 (0)