See also ...
/t/13519/1
I do not think, that the second parameter 'num' within the function '$loop(%fieldname%,num)' can control the number of loops.
The documention description may be incorrect.
I understand the second parameter as a boolean switch, which allows only two values 0 or 1.
The documention description may be incorrect.
$loop(%fieldname%,0) ...
... allows each item from the item list to be processed.
$loop(%fieldname%,1) ...
... allows only the first item of ambiguous items from the item list to be processed.
... restricts the focus to the first item of a group of items with the same value.
DD.20120607.1328.CEST