Very informative variables in nested loop

Member

lou_lindgren

by lou_lindgren , in category: Golang , 2 months ago

Very informative variables in nested loop πŸ˜ƒ ok -> okk -> okkk ....It might be okkkkkkkkkkkkkkkkkkkkkkkkkkkk in the end 😁

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
if user, ok := db.User[userId]; ok {
    for _, cardId := range user.CardIds {
        if card, okk := db.Card[cardId]; okk {
            if notif, okkk := db.Notif[card.NotifId]; okkk {
                card_notifs = append(card_notifs, CardNotif{card.Id, card, notif})
            }
        }
    }     
    c.JSON(http.StatusOK, card_notifs)
} else {  
    c.String(http.StatusNotFound, "")
}

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers