Using AND or OR for Multiple Conditions

  • Sorry if this has already been resolved, but i could not find it.

    I am looking to write an if statement that allows for multiple conditions, using both AND and OR
    Is there a way to do this...

    if (multiple conditions, true statement, false statement)

    I have tried AND and && and OR and || but i ran out of ideas

    I would rather do it this way than having a bunch of nested if statements.

    thanks
    Tom

  • Hi Tom,

    The documentation about IF action can be found here ...

    In my knowledge there is no logical operators like AND , OR in Krpano...

    I would rather do it this way than having a bunch of nested if statements.

    I think there is no other way...

    For example, for an AND like:
    IF( A == B AND C == D , then do_true_action , else do_false_action )

    Code
    if( A == B 	, <!-- pseudo AND -->
    		if( C == D 	, do_true_action();
    				, do_false_action();
    				);
    		, do_false_action();
    		);

    and for an OR like:
    IF( A == B OR C == D , then do_true_action , else do_false_action )

    Code
    <!-- pseudo inclusive OR -->
    set( OR , false );
    if( A == B , set( OR , true ); );
    if( C == D , set( OR , true ); );
    if( OR	, do_true_action();
    	, do_false_action();
    	);

    Hope this help...

    SAlut.

  • Thanks Michel!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!