[Solved] Go: basic for loop and strconv [closed]
[ad_1] Here’s one way to do it: fmt.Println(“Start of session”) defer fmt.Println(“Room Empty”) for i := 0; i < 6; i++ { s := Student{Name: “Student” + strconv.Itoa(i)} s.Present() defer s.Leave() } fmt.Println(“End of session”) playground example The deferred functions are executed on return from the function in reverse order. 5 [ad_2] solved Go: basic … Read more