Open jaffasplaffa opened 1 year ago
hi, it works like this:
var test;
switch {
case x==0: test := 0;
case x==1: test := 1;
case x==2: test := 2;
default: test := 0;
}
var out := test;
see also: http://www.partow.net/programming/exprtk/code/readme.txt (6) Control Structures
best regards
Hey :)
Thanks for the quick reply. I was not able to get {} working using a classic switch(I'd like to use more than one statement pr. case, so I ended up using if statements like this: if(x=0){code}; if(x=1){code}; if(x=2){code};
That works.
Thanks for the reference, that's really nice to know. I could figure some of it out on my own, from looking at the examples, but not all of it.
Do you think it's possible to have a link to that read me file in the same drop down menu as the manual?
It would be lovely to always have that the read me as a quickly accesable tool, like the manual.
@jaffasplaffa I think you probably want this:
https://github.com/ArashPartow/exprtk/blob/master/readme.txt#L613
Example usage: https://github.com/ArashPartow/exprtk-extras/blob/master/exprtk_fizzbuzz.cpp#L38
Hey guys :)
Sorry for the late reply!
Just want to say thanks for the tips, they were really helpful ;)
I managed to get most of the stuff I've been working on working now, with help from the documents you provided.
This absolutely one of my favourite VCV modules. The amount of module/cable clutter has been greatly reduced in my patches, by using this module.
it's just awesome!
Hey :)
I've made this switch for testing and I can't get it to work. Probably some syntax thing I am not getting right. I am hobby coder so no expert, but I do have a little experience.
Here is an example. This does not work in Formula One:
First I assign a variable. Then I have the switch. Then assign switch result to output.
What am I doing wrong?
Thanks in advance, Jaffa