WhileCondition is more of a do-while


Hi all,

I feel like this should be really simple but I’m struggling to set up a behavior that uses WhileCondition as a while loop instead of a do-while. For example, in this setup:

“do not speaketh” is output even if the WhileCondition is hardcoded to return false. What I want is for only “speaketh” to be output.
I’ve tried using it with other decorators like StartOn* and SucceedOn* but wasn’t able to find a combination that worked.

Thanks for your help!


Hi @erk

If I’m understanding your goal correctly you are looking to do the following in your example:

A. only have your “do not speaketh” TextToSpeech sequence and behavior combo execute if a condition is true. If that condition is not true you want to skip that TextToSpeech entirely and not play it at all.

B. If a condition is true you want to loop your “do not speaketh” sequence.

If that’s a correct summary of what you are trying to do you will likely be best served by a Switch behavior as discussed in this thread.

A specific example of what you could do is create something that looks like this:


Hi @john.w, thanks for the reply!

A small clarification on point A you listed: if the condition is true, “do not speaketh” should be output until the condition is set to false at some point AND “speaketh” should be output after that happens.

The behavior should match something like this in code:

    condition = true
    while (condition) {
        print('do not speaketh')
        /* at some point condition = false */

I was able to get it working with your solution though, thanks. In the future, do you think it would be possible to update the SDK to include a While decorator that evaluates the condition before executing its sequence? It does add some unnecessary complexity to have to work around the current WhileCondition in order to accomplish this.


I am glad you were able to get that working!

I will definitely let our team know that there are developers interested in the WhileCondition checking the conditional prior to executing the first time so they can be certain to take that into consideration for future SDK updates.