can you please give example on state machine either even or odd with best practices mutiple examples.
Go through the docs below which contains an example
For Even or Odd you can just change the flow this way
1. Variables (in Main.xaml):
number
: Int32 (set this to a number like5
in the Start state)
2. Start State (State: Start)
- Assign
number = 5
(or use Input Dialog to get user input) - Transition: →
CheckNumber
3. CheckNumber State
- No activities, only transitions:
- Condition:
number Mod 2 = 0
→ toEven
- Condition:
number Mod 2 <> 0
→ toOdd
- Condition:
4. Even State
- Activity:
Message Box
→"The number is Even"
- Transition to
End
5. Odd State
- Activity:
Message Box
→"The number is Odd"
- Transition to
End
Hope this helps
Hey @Abhilash_Yadav
State Machine Components
- State:
Start
- Action: Use Input Dialog to get number from user.
- Output: Store in variable
inputNumber (Int32)
Transition → CheckEvenOdd
- Condition:
True
(always proceeds)
- State:
CheckEvenOdd
- Action: Use
Assign
:
isEven = inputNumber Mod 2 = 0
Transition → DisplayResult
- Condition:
True
- State:
DisplayResult
- Action: Use If activity:
If isEven Then
Message Box → "The number is EVEN."
Else
Message Box → "The number is ODD."
Transition → End
- Condition:
True
4. Final State: End
- No actions.
cheers