简体   繁体   English

在Go中声明并未使用的变量

[英]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"? 为什么会收到错误消息:“ t声明且未使用”?

Because you declared a variable called t here: 因为您在此处声明了一个名为t的变量:

var i,t uint64 = 2,3

but never used that variable. 但从未使用过该变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM