- 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() } }

17th Jun 2021, 3:09 PM
Mokh. Aria Wirakusumah
Mokh. Aria Wirakusumah - avatar
2 Answers
+ 6
You have not created the structure, first create it!
17th Jun 2021, 3:17 PM
Abhiyantā
Abhiyantā - avatar
+ 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()}}
11th Apr 2022, 7:05 PM
Icey Python
Icey Python - avatar