A Conversation for An Introduction to Programming: Programming Loops
A533864 Programming Loops - An Introduction
xyroth Posted Apr 11, 2001
The shop example could be done as either a pre-test or post-test, using either "repeat ... until total=pressed" or "while not(total=pressed) ... endwhile". mentioning the destinction might be a good idea, as it lets you mention both types with the same example.
A533864 Programming Loops - An Introduction
Bright Blue Shorts Posted Apr 12, 2001
The links for those interested:
http://www.bbc.co.uk/h2g2/guide/A520895 - PSG version
http://www.bbc.co.uk/h2g2/guide/A533864 - BBS version
PSG - it's interesting that you say "The point is looking at programming loops within the area of programs, NOT looking at programming loops in the area of life." because ....
2 of my 3 examples - bank cashpoint and bank statement print are examples to the layman of how the programs might be working.
Meanwhile
2 of your 3 examples - buying sweets, finding a house in a street have no computers involved, just people.
Anyway I think we have differing styles, so maybe there isn't much more mileage to be gained. Personally I think my entry would go as a very nice introduction into yours. Sort of the best of both worlds
I leave it with you.
BBS
A533864 Programming Loops - An Introduction
manolan Posted Apr 12, 2001
Well, I don't really think either quite hits the mark. Perhaps I should create my own entry !
BBS. I think your entry is a little bit brief. You could also mention that variations of loops allow you to check the condition at the beginning or end of the loop (important because the latter guarantees that the loop code will be executed at least once). You could also mention some of the keywords which are often associated with these loops. I think you can do that without getting into too many specifics.
PSG. I think you could describe the functions of loops without writing lines of pseudo-code and having things like 'goto 3'. I also think that you should explain what a loop is first. Loops with conditions at the beginning and end are just variations on a basic conditional loop and could be treated as sub-types. I'm afraid I particularly don't like your example of a loop at the beginning as it should really be written as a condition at end (the code would be simpler). I don't understand the phrase "you can only access the code in the loop if a condition is true". Surely what you mean is the code in the loop is only executed if a condition is true. Likewise "it is part of the program". All code is part of the program.
Neither of you has addressed the generic loop of iterating over a series of values (of which the counting loop is just a specific example). These loops are represented in various languages with 'for' or 'foreach', but the key point is that they allow iteration over something other than a simple index. In MS VBA, you can iterate over a collection and in perl, you can iterate over the keys of a hash.
A533864 Programming Loops - An Introduction
Researcher PSG Posted Apr 17, 2001
It is now clear to me that this entry could get bogged down impossibly.
If we as a group cannot agree on the best, all things considered, entry. Even if it is slightly inperfect, then there will be no definition. which I feel will be more detrimental than an inperfect, and therefore human (as nothing is truely perfect) entry.
So, in short, clear, bullet points rather than sentances, please put down what you feel the perfect entry will be. And then it can be debated clearly.
Researcher PSG
A520895 Programming Loops (a universal definition)
HenryS Posted Apr 17, 2001
A possible example of divide and conquer recursion in rl:
How to get something done in a large beauracracy (sp?):
You've just been given some work to do:
If you're not the tea boy, split the job into 2 smaller bits, and give one bit to each of your subordinates.
When they've both returned the finished work to you, put the bits back together.
Give the finished work back to whoever gave you the job.
If you are the tea boy, do it yourself, then give the finished work back to whoever gave you the job.
A520895 Programming Loops (a universal definition)
Nick Fel Posted Apr 17, 2001
A nice little programming loop in BASIC is:
10 PRINT "This program is silly."
20 GOTO 10
A520895 Programming Loops (a universal definition)
Researcher PSG Posted May 15, 2001
Hello!
It's been a while, but I have had a bit of a think.
To the Moderators:
Please remove this conversation from peer review, I have decided to withdraw the entry from consideration.
To everyone who has contributed to this conversation:
Thanks for your input, I have decided to set up a University of Life project on An introduction to Programming, and I have just been approved. There should be a link on the current projects page in due course.
If any of you would like to help on the project I would be glad of the help and input.
Researcher PSG
A520895 Programming Loops (a universal definition)
Martin Harper Posted Jun 26, 2001
Actually, it is scouts who do removals, not moderators - I'll see what I can do about getting it moved...
Key: Complain about this post
A533864 Programming Loops - An Introduction
More Conversations for An Introduction to Programming: Programming Loops
Write an Entry
"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."