# Stopping a sequence / Assertions

**URL:** <https://forum.farmbot.org/t/stopping-a-sequence-assertions/5524>\
**Category:** Sequences\
**Created:** [October 5, 2019, 4:51pm UTC](https://forum.farmbot.org/t/stopping-a-sequence-assertions/5524 "2019-10-05T16:51:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbuchberger1967](https://forum.farmbot.org/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@mbuchberger1967](https://forum.farmbot.org/u/mbuchberger1967)\
**Post date:** [October 5, 2019, 4:51pm UTC](https://forum.farmbot.org/t/stopping-a-sequence-assertions/5524/1 "2019-10-05T16:51:24Z")

</div>

Hi there,  
I was very disapointed when I understood that I cannot stop / abort a sequence execution, e.g. due to Tool Mount Error or similar.  
But now in V8 there is the new command “Assertion”, which seems to have a possibilty to “recover and continue”, “abort”, … i.e. exactly what I am looking for.  
The docu also states that Assertions are only for Developers, but I would like to use them in my regular sequences… What do I need to do to enable them so I can use them in my sequences? Is trhere a way?

Thanks  
Markus

---

<div class="post-metadata">

**Author:** ![roryaronson](https://forum.farmbot.org/user_avatar/forum.farmbot.org/roryaronson/32/24_2.png) [@roryaronson](https://forum.farmbot.org/u/roryaronson)\
**Post date:** [October 7, 2019, 4:11pm UTC](https://forum.farmbot.org/t/stopping-a-sequence-assertions/5524/2 "2019-10-07T16:11:05Z")

</div>

Thank you for the feedback @mbuchberger1967. What you’re trying to accomplish is doable in a very specific way with the IF statement: use an IF command to check **IF** a condition (eg: tool failed to mount) is true and **THEN** branch to some error handling sequence, **ELSE** another sequence containing ‘the rest of what you want to do’. Unfortunately there can’t really be any commands _after_ the IF statement because the execution will come back to the main sequence after branching in either case, and you probably wouldn’t want more stuff there that will always execute for both cases.

I think that’s the only way to accomplish what you want without Farmware or Assertion. We’re discussing internally how to better handle use cases like this (and there have been some feature requests for similar issues as well). We’ll likely either be adding support for one or both of the following:

A) An abort or e-stop command that could escape all execution.

B) Extra dropdown options in the IF statement command that allow users to `Abort` or `Abort and Recover` . We already essentially support `Recover` (via sequence branching) and `Continue`, if you’re comparing to the Assertion command.

In the meantime, you _can_ use the Assertion command for your use case. While it _is_ intended for software developers (because you have to write your assertion in code rather than using some inputs and dropdown menus), anyone can use it. Just add the command to your sequence from the commands list on the right side of the sequence editor page. Note: you may need to scroll down the list to see it!

---

<div class="post-metadata">

**Author:** ![mbuchberger1967](https://forum.farmbot.org/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@mbuchberger1967](https://forum.farmbot.org/u/mbuchberger1967)\
**Post date:** [October 10, 2019, 10:43pm UTC](https://forum.farmbot.org/t/stopping-a-sequence-assertions/5524/3 "2019-10-10T22:43:45Z")

</div>

ok, the problem was so simple… I just couldn’t see Assertions because I had to scroll down 🙂

assertion code is not a problem, as I am a software developer…  
Thank you!

---

<div class="post-metadata">

**Author:** ![mvillion](https://forum.farmbot.org/user_avatar/forum.farmbot.org/mvillion/32/5152_2.png) [@mvillion](https://forum.farmbot.org/u/mvillion)\
**Post date:** [May 18, 2024, 10:28pm UTC](https://forum.farmbot.org/t/stopping-a-sequence-assertions/5524/4 "2024-05-18T22:28:23Z")

</div>

Hi Rory  
Maybe the code has moved on from this post but I have found that the IF statement does return and continue executing. I use it to great affect. Has the IF code progressed from this time and space, or am I looking at an anomaly?

Thanks

---

<div class="post-metadata">

**Author:** ![roryaronson](https://forum.farmbot.org/user_avatar/forum.farmbot.org/roryaronson/32/24_2.png) [@roryaronson](https://forum.farmbot.org/u/roryaronson)\
**Post date:** [May 21, 2024, 10:20pm UTC](https://forum.farmbot.org/t/stopping-a-sequence-assertions/5524/5 "2024-05-21T22:20:59Z")

</div>

I don’t believe there have been any substantial changes to the IF statement command since this thread. So this still stands:

> [@roryaronson](#):
>
> there can’t really be any commands _after_ the IF statement because the execution will come back to the main sequence after branching in either case, and you probably wouldn’t want more stuff there that will always execute for both cases.

If trying to accomplish something with more complex logic then you’re best off dropping into Lua.

---

<div class="post-metadata">

**Author:** ![mvillion](https://forum.farmbot.org/user_avatar/forum.farmbot.org/mvillion/32/5152_2.png) [@mvillion](https://forum.farmbot.org/u/mvillion)\
**Post date:** [May 21, 2024, 10:28pm UTC](https://forum.farmbot.org/t/stopping-a-sequence-assertions/5524/6 "2024-05-21T22:28:34Z")

</div>

> [@roryaronson](#):
>
> ’. Unfortunately there can’t really be any commands _after_ the IF statement because the execution will come back to the main sequence after branching in either case, and you probably wouldn’t want more stuff there that will always execute for both cases.

Ah. I have misread the post. I misread that you cannot put anything after the IF statement which I interpreted that it did not return (which it does as you stated).
