I have a loop in my code that just needs to execute a certain number of times.I don't make any reference to the loop control variable anywhere in the body of the loop, but since the for clauses have to test it against the limit and increment it, I can't use _. So instead, I just used _i, as a signal that the variable's value was unused. Does that seem reasonable, or would it be better Go to just leave it as bog-standard i and not worry about signalling the don't-care condition?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
It's a feature. "Any caller can have a loop counting any number of iterations that he wants so long as it is 10." – Henry Ford
> 10.times
10 times what?
On Mon, 2015-04-06 at 10:54 -0400, Shawn Milochik wrote:
> On Mon, Apr 6, 2015 at 10:53 AM, andrey mirtchovski <
> mirtc...@gmail.com>
> wrote:
>
> > > 10.times
> >
> > 10 times what?
Rob's code fragment was:
for i := 0, i < 10; i++
without a code body, which was nonetheless implied. I just used the
same sort of fragment showing the control without the following code
block.
> >
> Please don't feed the trolls.
Far from being a troll.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russ...@ekiga.net
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/G7Cm6wRrVkA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
On Sun, 2015-04-05 at 14:01 -0700, Rob Pike wrote:
> for i := 0; i < 10; i++
>
> Short, simple, straightforward, clear, obvious, understandable, not a
> puzzle, not cute, not confusing, just right, just do it.
>
Whilst this is the way it has to be done in Go, I think you are wrong
on all counts. This is why things like:
10.times
for _ in 1..10
and other variants have been chosen in other languages.