Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #1976
| From | Mok-Kong Shen <mok-kong.shen@t-online.de> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: repeating something n times |
| Date | 2012-07-18 20:44 +0200 |
| Organization | albasani.net |
| Message-ID | <ju7060$qgu$1@news.albasani.net> (permalink) |
| References | <repeat-20120705210751@ram.dialup.fu-berlin.de> |
Am 05.07.2012 21:13, schrieb Stefan Ram:
> It is funny how many languages fail to give a means to
> repeat something n times.
>
> In Logo, one can write:
>
> repeat 4
>
> to repeat something 4 times, but in C one needs
>
> for( int i = 0; i < 3; ++i )
>
> , where the need to introduce a variable in the source code
> seems redundant in this case and more troublesome and error-prone.
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. Thus one would need something
to tell the processor whether one does the first time, the second
time, etc. a certain task and consequently an index, e.g. i, would
be quite naturally needed. Maybe you don't like C's for-loop,
because the computational incrementing of i is explicitly shown.
Comparatively less explicit is, for example, in Fortran:
DO I = 1, 4
-----
END DO
M. K. Shen
Back to comp.programming | Previous | Next — Next in thread | Find similar | Unroll 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