What kind of design is comparable to these programming concepts? I understand this may sound like a weird question, but bear with me here, OK?

I'm getting ready to teach some kids introductory computer programming. We're going to use Scratch, a drag-and-drop "brick-based" language designed by MIT.

Now, scripts in Scratch are comparable to LEGO structures. Each script needs a base, and pieces to build it up. So far, so good.

However, scripts can also contain conditionals and loops, both of which accept a sub-structure.

I would like to show my students a LEGO structure that is comparable to a Scratch script. How could i do something like conditionals and loops?
A conditional can perhaps be represented by a door that can be blocked from the other side, or maybe two doors, of which only one is blocked via a sliding brick.

As for loops, I would represent them as conditionals with counters, by blocking a door with a set number of bricks and removing one brick per iteration. If you'd rather count upwards, then a fixed size hole can be filled with bricks gradually.

These analogies were made to the "minifig walking through a set of corridors - the program" analogy, but we could surely find solutions for axles and gears or even pneumatics if you were thinking along those lines.