2 ms·
That is consistent though. Constants take type based on context, so 8 * time.Hour has 8 as a time.Duration. If you have an int variable hours := 8, you have to
by porridgeraisin 1y ago
That is consistent though. Constants take type based on context, so 8 * time.Hour has 8 as a time.Duration.
If you have an int variable hours := 8, you have to cast it before multiplying.
This is also true for simple int and float operations.
f := 2.0
3 * f
is valid, but x := 3 would need float64(x)*f to be valid. Same is true for addition etc.
- throwawaymaths 1y agoIt's also completely insane if youve ever done any scientific work.
- porridgeraisin 1y agoApart from the extra verbosity, what gives?