You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

TCarpenter

Beginner

  • "TCarpenter" started this thread

Posts: 1

Location: Villanova PA

Occupation: Graduate Student

  • Send private message

1

Wednesday, November 10th 2010, 10:43pm

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

VN2009

Professional

Posts: 1,334

Location: Duluth MN

  • Send private message

2

Wednesday, November 10th 2010, 11:02pm

AND/OR is not avialable i dont think.

this is what we have available.

== or === or !== whats the difference?

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

3

Thursday, November 11th 2010, 2:18am

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 )

Source code

1
2
3
4
5
6
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 )

Source code

1
2
3
4
5
6
7
<!-- 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.

VN2009

Professional

Posts: 1,334

Location: Duluth MN

  • Send private message

4

Thursday, November 11th 2010, 3:11am

michel you are a friggen genius you always amaze me!

5

Saturday, June 15th 2013, 4:12pm

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 )

Source code

1
2
3
4
5
6
if( A == B 	, 
		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 )

Source code

1
2
3
4
5
6
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!

Similar threads