Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #1985

Re: repeating something n times

From "BartC" <bc@freeuk.com>
Newsgroups comp.programming
Subject Re: repeating something n times
Date 2012-07-19 10:16 +0100
Organization A noiseless patient Spider
Message-ID <ju8j9l$in9$1@dont-email.me> (permalink)
References <repeat-20120705210751@ram.dialup.fu-berlin.de> <ju7060$qgu$1@news.albasani.net> <ju786l$2uf$1@dont-email.me> <f0173adc-e3a6-4057-9b9b-589e61d7ae03@googlegroups.com>

Show all headers | View raw


<malcolm.mclean5@btinternet.com> wrote in message 
news:f0173adc-e3a6-4057-9b9b-589e61d7ae03@googlegroups.com...
> בתאריך יום רביעי, 18 ביולי 2012 22:00:29 UTC+1, מאת Bart:
>> &quot;Mok-Kong Shen&quot; &lt;mok-kong.shen@t-online.de&gt; wrote in 
>> message
>> news:@news.albasani.net...
>> Am 05.07.2012 21:13, schrieb Stefan Ram:
>>
>>  I believe that in the normal/common cases one doesn't simply
>>  "exactly" redo something n times, but does at least a little
>>  bit different in the repetitions.
>>
>> There are plenty of examples where you want do just that. Printing N 
>> spaces
>> for example.
>>
> It's easy enough to think of examples.But they rarely come up. I don't 
> think there's a single case in my current program of a loops where the 
> number of iterations is known at loop entry, and where the loop index 
> isn't used in the loop body. The program contains literally thousands of 
> loops.

My code uses such loops all the time. Perhaps because the idiom is there, I 
make use of it. Where there are only indexed loops, or the C style of loops, 
I suppose you tend to code around those.

It's very handy also when writing quick tests or benchmarks, you often do 
want run piece of test code N times without messing around with all the 
syntax that is otherwise required.

-- 
Bartc 

Back to comp.programming | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: repeating something n times Mok-Kong Shen <mok-kong.shen@t-online.de> - 2012-07-18 20:44 +0200
  Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-18 22:00 +0100
    Re: repeating something n times malcolm.mclean5@btinternet.com - 2012-07-19 00:48 -0700
      Re: repeating something n times "BartC" <bc@freeuk.com> - 2012-07-19 10:16 +0100
        Re: repeating something n times malcolm.mclean5@btinternet.com - 2012-07-19 14:36 -0700

csiph-web