0
Reset The Timer
Does anybody solve this task in Golang?
6 Réponses
+ 1
Václav Dostál
I did this way:
package main
import "fmt"
type Timer struct {
id string
seconds int
}
func main() {
var x int
fmt.Scanln(&x)
t := Timer{"ABC", x}
reset(&t)
fmt.Println(t)
}
// my implementation is written below
func reset(t *Timer) {
t.seconds = 0
}
+ 1
Previously I didn't know how to solve it, then I found this material in the following link with some examples and it helped me.
https://tour.golang.org/methods/5
+ 1
package main
import "fmt"
type Timer struct {
id string
seconds int
}
func reset(t *Timer) {
t.seconds = 0
}
func main() {
var x int
fmt.Scanln(&x)
t := Timer{"ABC", x}
reset(&t)
fmt.Println(t)
}
0
package main
import "fmt"
type Timer struct {
id string
seconds int
}
func reset(t *int) {
//t := &Timer{Timer.name, 0}
//*x = 0
}
func main() {
var x int
fmt.Scanln(&x)
t := Timer{"ABC", x}
reset(&t)
fmt.Println(t)
}
0
This task I mean
0
Nice but I need help with the task Reset The Timer in Golang course.