ã¸ã§ããªã¯ã¹ã®è©±é¡ã«ãªãã¨å¸¸ã«åºã¦ããã®ãã for ã«ã¼ãã®ä»£ããã«é¢æ°åã¹ã¿ã¤ã«ã§æ¸ãããã¨ããè¦æã§ãã for ã«ã¼ãã§æ¸ãã®ã¯ãå¯èªæ§ãæªããçåãããã¨ã¾ã§è¨ã人ããã¾ãã ããããã¸ã§ããªã¯ã¹ã追å ããã¦ãããã®ã¹ã¿ã¤ã«ã®ããã°ã©ãã³ã°ã¯å®ç¨çã«ã¯ãªãã¾ãããã¸ã§ããªã¯ã¹ä»¥å¤ã«ã足ããªãé¨åãããããããã®ã§ãã ä¾ãã°ã次ã®ãããªã³ã¼ããèãã¦ã¿ã¾ãããã type PointLog struct { ID int64 UserID int64 Point int32 } // ä»ã®æ¸ãæ¹ func UserTotalScore(log []PointLog, userID int64) int64 { var t int64 = 0 for _, p := range log { if p.UserID == userID { t += int64(p.Point) }
{{#tags}}- {{label}}
{{/tags}}