Showing results for 
Search instead for 
Did you mean: 

State machine with array



       I had a question wrt state machine. Is it possible to make a statemachine with for loop as an array numerical input for max and min operation? How to create the same operation with array input in case of while loop?

0 Kudos
Message 1 of 3

If you have a very set order, then an autoindexing FOR loop works well.  I typically don't like doing that since I often need to react to things (in other words, the order is not exactly set).


I have found that using a queue to hold your states works very well.  That way you can enqueue many states and then dequeue an element with each iteration of the loop.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3

You may want to post some code, it isn't quite clear what you are trying to do.  But yes you should be able to use an array of strings, and enqueue and dequeue elements from it.  I have seen this done using a for loop, with an abort operation on the conditional stop.  But a while loop is more flexible.

0 Kudos
Message 3 of 3