Hi Karin,

I’ve not used it in an SWC context, but a couple of useful metaphors might be:

- a weekly travel card/multiride card on whatever the local public transport 
is. (On the old GM buses, this used to be a real piece of cardboard that would 
be clipped by a machine, giving a visual representation). A metaphor is, 
approximately:

for rides on card:
        get on transport
        ride
        get off

(it kind of breaks down as you do other things at either end of the journey, 
rather than remaining within the loop)


- a dental checkup. There are a finite number of teeth, and the dentist checks 
each one in turn for cavities and gum disease

teeth=[upper left wisdom, upper left molar, … , upper right molar, upper right 
wisdom, lower right wisdom, lower right molar, … lower left wisdom]
for tooth in teeth:
        check tooth
        check surrounding gum


- checking your email in the morning. Treating each item of mail in the inbox 
as an item to be dealt with

for mail in inbox:
        read mail
        importance = judge worth of mail()
        if importance > boredom threshold:
                do something(mail)      

Although the cognitive load of deciding whether to deal with an email does 
defeat us all in the end (not a metaphor ;) )


I hope at least one of these might be useful, or spark ideas for something that 
actually is.

Cheers,

L.

> On 3 Dec 2015, at 09:24, Karin Lagesen <[email protected]> wrote:
> 
> The more I teach, the more I realize that I am not really able to convey what 
> a for loop does to everybody. Do any of you have a metaphor or something that 
> you use for teaching it? I explain about variables and collections, and the 
> body of the loop, and I show examples, but I am still not able to get through 
> all the time.
> 
> Karin
> 
> _______________________________________________
> Discuss mailing list
> [email protected]
> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org

-- 
Leighton Pritchard
[email protected]
gpg/pgp:0xDECACFFC



_______________________________________________
Discuss mailing list
[email protected]
http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org

Reply via email to