# Flow control: ElseIf and AndTry

**URL:** https://www.finalbuilder.com/forums/t/flow-control-elseif-and-andtry/3797
**Category:** Feature Requests
**Created:** [December 16, 2006, 5:50am UTC](https://www.finalbuilder.com/forums/t/flow-control-elseif-and-andtry/3797 "2006-12-16T05:50:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [December 16, 2006, 5:50am UTC](https://www.finalbuilder.com/forums/t/flow-control-elseif-and-andtry/3797/1 "2006-12-16T05:50:48Z")

</div>

FB Needs an ElseIf action, so I don’t have to nest IFs inside of Else actions. Unless there is a better way?  
  
And with Try, what’s with the Finally block?  
What’s the difference between this:  
Try  
-Step1  
Catch  
-Log Error  
Finally  
-Step2  
End  
…And this:  
Try  
-Step1  
Catch  
-Log Error  
End  
Step2  
  
I wish there were another action, maybe called AndTry that would work only if the previous Try didn’t Catch.  
So instead of this mess:  
Try  
-Step1  
-Try  
–Step2  
–Try  
—Step3  
–Catch  
—Log Error3  
–End  
-Catch  
–Log Error2  
-End  
Catch  
-Log Error1  
End  
…you could do this:  
Try  
-Step1  
Catch  
-Log Error1  
AndTry  
-Step2  
Catch  
-Log Error2  
AndTry  
-Step3  
Catch  
-Log Error3  
End  
…which just seems easier to read.

---

<div class="post-metadata">

### Author: ![stevage](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@stevage](https://www.finalbuilder.com/forums/u/stevage)
#### Post date: [December 17, 2006, 11:57am UTC](https://www.finalbuilder.com/forums/t/flow-control-elseif-and-andtry/3797/2 "2006-12-17T11:57:27Z")

</div>

The “finally” block is mostly useful without the catch block:  
  
try  
 do some stuff that might fail  
finally  
 do cleanup, which will get called no matter what  
endtry  
  
is very different to:  
  
do some stuff that might fail  
do cleanup, which won’t get called if there’s an exception.  
  
In the example you give, the ‘finally’ block will be called even if the ‘try’ block runs an 'Exit action list" action. Not sure about the semantics if an exception is raised - I suspect the two forms have the same behaviour.  
  
Steve

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [December 18, 2006, 12:08pm UTC](https://www.finalbuilder.com/forums/t/flow-control-elseif-and-andtry/3797/3 "2006-12-18T12:08:33Z")

</div>

Hi Mike  
  
I agree, an ElseIf action would be useful, I’ll see what we can do. Most probably it would just become an option on the existing If then action.  
  
As for try finally, it works like this :  
  
Try  
 some stuff that might raise an exception  
Catch  
 handle the exception otherwise do nothing  
Finally  
 run whether there is an exception or not!  
end  
  
In the above example, if an action inside the try block fails, the build will not stop.  
  
Try  
 some stuff that might raise an exception  
Finally  
 run whether there is an exception or not!  
end  
  
In this example, the build would stop once the finally block has run.  
  
HTH

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [December 19, 2006, 8:36am UTC](https://www.finalbuilder.com/forums/t/flow-control-elseif-and-andtry/3797/4 "2006-12-19T08:36:43Z")

</div>

Posted By Vincent Parrett on 17 Dec 2006 5:08 PM  
Hi Mike  
  
I agree, an ElseIf action would be useful, I'll see what we can do. Most probably it would just become an option on the existing If then action.  
  

  
OK, sounds good.  
  
What about the daisy-chain try that I suggested?  
  
Right now it seems the only way to track a particular error without having to nest the Try blocks is to set a variable before each action and then put a Select structure in the Catch block. Hmm.. maybe you could make a generate variable that when you enter a Catch block it would contain information on the action that failed?

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [December 20, 2006, 12:52pm UTC](https://www.finalbuilder.com/forums/t/flow-control-elseif-and-andtry/3797/5 "2006-12-20T12:52:01Z")

</div>

That will require some more lengthy R&D. I’ll discuss this with the team in the new year, we already have a pretty full schedule for Q1 though, so I can’t give you any idea when the R&D wll be done.

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [December 22, 2006, 6:23am UTC](https://www.finalbuilder.com/forums/t/flow-control-elseif-and-andtry/3797/6 "2006-12-22T06:23:54Z")

</div>

Seems that the second option in my request is similiar to a request made by Steve Bennett:  
[https://www.finalbuilder.com/forums.aspx?forumid=1&postid=2084&view=topic](https://www.finalbuilder.com/forums.aspx?forumid=1&postid=2084&view=topic)
