유종명
유종명

Reputation: 29

variable declared and not used in Go

In the following code:

func PrimeF(n uint64) {
var i,t uint64 = 2,3


for ; i < n; {
    if n%i == 0 {
        n /= i
    }

   }
}

Why do I get the error message: "t declared and not used"?

Upvotes: 1

Views: 346

Answers (1)

thwd
thwd

Reputation: 24808

Because you declared a variable called t here:

var i,t uint64 = 2,3

but never used that variable.

Upvotes: 7

Related Questions