Loop in formula language

Hi I am using a computed Date time field,where i am calculating the time,now i need to check if my date is not empty then the formula should

run other wise it shuld give me 0 days,0 hours o minutes o seconds

my formula is :-

The field name is closed_on

TimeTaken:=@If(r_assignedon!=“” & r_escalatedon=“”;(r_closedon - r_assignedon);r_assignedon!=“” & r_escalatedon!=“”;(r_closedon - r_escalatedon);(Now - r_closedon));

oldval:=@If(r_escalatedon=“” & r_assignedon=“”;0;r_escalatedon=“”;((r_closedon - r_assignedon));((r_escalatedon - logged)));

@Text(@Integer(TimeTaken/86400)) + " Days "

@Text(@Integer((TimeTaken - (@Integer(TimeTaken/86400)*86400)) /3600)) + " Hours "

@Text(@Integer((TimeTaken - (@Integer(TimeTaken /3600)*3600)) /60)) + " Minutes "

@Text(@Integer((TimeTaken - (@Integer(TimeTaken /60)*60)))) + " Seconds";

Subject: Loop in formula language

Did you have a question?