hello,
i am new to everything is new in programming-heaven. old-c-guy. and i thought it`s time to learn something most-modern ..
time.NewTicker( time.Second ) ok
time.NewTicker( 5 * time.Second ) ok
var n int = 5
time.NewTicker( n * time.Second ) error : int * duration
time.NewTicker( time.Duration(n) * time.Second ) ok : duration * duration [s^2] square-seconds ?
tick := time.NewTicker( time.Duration( math.rand.Intn(10) ) * time.Second )
go func() { for { select {
case <-done : return
,case tc := <-tick.C : **** tick ****
}}}()
this strategy gets the tick if it has already happend in past and this go-routine is active
if it is suspended will it be notified as soon in either done or tick something is to read ?
when i (later) write own code / interfaces / struct where inside is like in ticker the .C a channel, can i define something like an operator, so that the outer object acts like a channel
type S struct {
C chan time
..
}
s := S{C:make(chan time),..}
s<-
<-s