Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

TCarpenter

Anfänger

  • »TCarpenter« ist der Autor dieses Themas

Beiträge: 1

Wohnort: Villanova PA

Beruf: Graduate Student

  • Nachricht senden

1

Mittwoch, 10. November 2010, 22:43

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

2

Mittwoch, 10. November 2010, 23:02

AND/OR is not avialable i dont think.

this is what we have available.

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

3

Donnerstag, 11. November 2010, 02:18

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 )

Quellcode

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 )

Quellcode

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.

4

Donnerstag, 11. November 2010, 03:11

michel you are a friggen genius you always amaze me!

5

Samstag, 15. Juni 2013, 16:12

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 )

Quellcode

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 )

Quellcode

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!

Ähnliche Themen