Concept Flow - Signal routing
Input Signal
Routing Decision
Route 1
Process 1
Output Signal
The input signal is checked and routed based on a condition to one of two processing paths, then combined into the output.
inputSignal = 5; if inputSignal > 3 routedSignal = inputSignal * 2; else routedSignal = inputSignal + 1; end outputSignal = routedSignal;
| Step | inputSignal | Condition (inputSignal > 3) | Branch Taken | routedSignal | outputSignal |
|---|---|---|---|---|---|
| 1 | 5 | 5 > 3 is True | Yes (if branch) | 5 * 2 = 10 | |
| 2 | 10 | ||||
| Exit | Condition checked once | Routing done | Value assigned | Output assigned |
| Variable | Start | After Step 1 | After Step 2 | Final |
|---|---|---|---|---|
| inputSignal | undefined | 5 | 5 | 5 |
| routedSignal | undefined | 10 | 10 | 10 |
| outputSignal | undefined | undefined | 10 | 10 |
Signal routing uses conditions to send input signals down different paths. Syntax: if condition, route one way; else, route another. Output depends on which branch runs. Useful for processing signals differently based on value.
signal = -5;
if signal > 0
routed = 1;
else
routed = -1;
end
routedsignal = 10;
if signal > 5
output = 1;
else
output = 0;
Pass the test and this pattern moves unknown