I'm trying to make this loop restart every time a name is already in the list, this code is obviously only going to check this once. Is there any way to make the loop restart from beginning? Thanks!
for _, client := range list.clients {
//for i := 0; i < len(list.clients); i++ {
if(client.name==name){
connection.Write([]byte("Name already exists please try another one:
"))
bytesRead, _ := connection.Read(reply)
name = string(reply[0:bytesRead])
name = strings.TrimSuffix(name, "
")
}
}