if(cond-else)

koadrobot/logics/if(cond-else)

IF - GATE R=COND ? T : F Allows values to pass through COND pin.
if(cond-else)
@/if(cond-else)
IF - GATE R=COND ? T : F Allows values to pass through COND pin.
CONDboolean
Whether values should pass through
Tnumber
Value to be output if condition is true
Fnumber
Value to be output if condition is false
if(cond-else)
R
COND
T
F
Rnumber
Outputs value of `T` if `COND` is true, and `F` otherwise
To use the node in your project you should have the koadrobot/logics library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD dirtieness disable

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    bool cond = getValue<input_COND>(ctx);
    auto trueVal = getValue<input_T>(ctx);
    auto falseVal = getValue<input_F>(ctx);
    emitValue<output_R>(ctx, cond ? trueVal : falseVal);
}

Tabular tests

CONDTFR
false0.51.251.25
false102020
true102010