Elseif or And Operator

chriswinn

2019-06-23 07:29:01

Hello everyone,

Just curious if there is an option to leverage "and" operators to check if more than 1 statements is true prior to doing something.

if the operator for "and" was something like... {&&}

if pp==6 && qq==51 then pp=0

Steve-Bome Forum Moderator

2019-06-23 08:11:08

Hi Chris,

Unfortunately Bome MIDI Translator Pro does have complex boolean operators like AND, OR, ELSE, but you can simulate them in multiple rules, Below are some examples with comments on what they do.

 

// If pp==1 AND qq==3 then rr=4 else rr=5
rr=5
If pp!=1 then skip next 2 rules
If qq!=3 then skip next rule
rr=4
//end

// If pp==1 OR qq==3 then rr=4 else rr=5
rr=5
If pp==1 then skip next rule
If qq!=3 then skip next rule
rr=4
//end

// if pp==1 AND qq==3 AND rr==4 then ss=5 else ss=6
ss=6
If pp!=1 then skip next 2 rules
If qq!=3 then skip next rule
If rr!=4 then skip next rule
ss=5

// if pp==1 OR qq==3 OR rr==4 then ss=5 else ss=6
ss=6
If pp==1 then ss==5
If qq==3 then ss==5
If rr==4 then ss=5

// parenthesis implicit here
// if (pp==1 OR qq==3 ) AND rr==4 then ss=5 else ss=6
/ first set the else
ss=6
// Now the OR
If pp==1 then skip next rule
If qq!=3 then skip next rule
// either pp==1 or qq=3
// Now the AND
If rr=4 then ss=5

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

Steve-Bome Forum Moderator

2019-06-23 16:25:44

For your specific example. In this case, unless you defined the value of pp earlier , the value of pp is undefined (some random value) if the two conditions are not met:

// if pp==6 && qq==51 then pp=0

if pp!=6 then skip next 2 rules

if qq!=51 then skip next rule

pp=0