For each: a reverse loop

Hi,

Couldn’t find a way to loop thru a collection from END to START

This code loops from START to END
<code 4D>
C_TEXT($T_Fil_ariane)
$T_Fil_ariane:=""

C_COLLECTION($C_Chain)
$C_Chain:=Get call chain

C_OBJECT($O_Temp)
For each ($O_Temp;$C_Chain;1;$C_Chain.length) // item 0 is skipped

$T_Fil_ariane:=$T_Fil_ariane+$O_Temp.name+">"

End for each
</code 4D>

Can you?

you can create a reverse collection

https://doc.4d.com/4Dv18/4D/18/collectionreverse.305-4505875.fr.html

: Keisuke MIYAKO

you can create a reverse collection

Great.

Does the for each loop offer a reverse loop function?

I can’t think of any language where foreach can iterate in reverse. I’d use a for loop instead for that.