- 1
what part is wrong about it?
package main import "fmt" func main() { var x int fmt.Scanln(&x) t := Timer{"timer1", 0} for i:=0;i<x;i++ { t.tick() } }
2 Antworten
+ 6
You have not created the structure, first create it!
+ 1
Try:
package main
import "fmt"
type Timer struct{
//firstvalue string
//secondvalue int
}
func tick(){
//code to tick goes here
}
func main(){
var x int
fmt.Scanln(&x)
t:=Timer{firstvalue: "timer1",secondvalue:0}
for i:=0;I
i<x;I++{
tick()}}