[Tutor] Differences between while and for
Alan Gauld
alan.gauld at yahoo.co.uk
Sat Jun 15 16:55:18 EDT 2019
On 15/06/2019 05:53, mhysnm1964 at gmail.com wrote:
> In C, Perl and other languages.
As a point of interest not all languages have these constructs.
Oberon, for example, only has a while loop because it can be
used to simulate all other loop types. Some Lisp dialects
don't even have a loop construct because recursion can be
used instead.
In addition to for, while and repeat/until some languages
(eg ADA and some BASICs) include a general loop construct.
And of course in assembler GOTO is the ultimate loop construct.
Don;t assume that just because one language supports a
particular construct that others will or should also support
it. The variety of control structures offered is one of the
defining features of any programming language.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list