I have a few functions taking an uint
as their input :
func foo(arg uint) {...}
func bar(arg uint) {...}
func baz(arg uint) {...}
I have a loop whose limits are both constant uint
values
const (
Low = 10
High = 20
)
In the following loop, how can I say I want i
to be a uint
? The compiler complains about it being an int
.
for i := Low; i <= High; i++ {
foo(i)
bar(i)
baz(i)
}
I don't really want to call uint(i)
on each function call, and doing the following is correct but makes me feel dirty :
var i uint
for i = Low; i <= High; i++ {
foo(i)
bar(i)
baz(i)
}