I want to do a simple thing:
func (this *ScoreProvider) getScore()(res float64) {
var score1 int16 = 500
var score2 int16 = 400
var score3 int16 = 300
var score4 int16 = 200
res = score1 * 0.25 + score2 * 0.25 + score3 * 0.25 + score4 * 0.25
return
}
But this reports an error:
can not use score1 * 0 + score2 * 0 + score3 * 0 + score4 * 0 (type int16) as type float64 in assignment
How can I do this right?