[Solved] Go: basic for loop and strconv [closed]
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 solved Go: basic for loop … Read more