Simpler Genexpr


    Mar 23 2021 | 2:45 pm
    If I work in Gen I heavily use the codebox, but sadly I couldn't finde too much documentation about it. So I have the following code
    if (in3 > 1.5){ if (in3 < 2.5){ n = in1; v = in2 / 127; } }
    In other languages like C++ you could use a statment like
    if (in3 > 1.5 and in3 < 2.5) {...
    Is there a way make something similar in gen as well? And if yes how do you do it?

    • Mar 23 2021 | 4:27 pm
      yes, you can just combine them with a logical AND('&&'), like this: if((in3 > 1.5)&&(in3 < 2.5)) { n = in1; v = in2 / 127; }
    • Mar 23 2021 | 5:19 pm
      Thanks a lot.
    • Mar 23 2021 | 5:34 pm
      no worries, happy to help :) just wanted to mention also, not useful for your case here, but for other shorter forms of 'if', you can also use the 'ternary' operator and embed it within itself, my example here is not so smart but just to show the idea: