yet another example with nested loop