Operator OR || question

Post » Sat May 18, 2013 1:54 am

Hi all

http://www.creationkit.com/Operator_Reference

I'm having some trouble with this kind of expression, this one doesn't work:

If A == (B || C || D)

;Do stuff

Endif

This doesn't work too:

If A == B || C || D

;Do stuff

Endif

But this one does:

If A == B || A == C || A == D

;Do stuff

Endif

Is this normal? I think the first model should work.

I appreciate input, thanks.

User avatar
Joanne Crump
 
Posts: 3457
Joined: Sat Jul 22, 2006 9:44 am

Post » Sat May 18, 2013 10:08 am

Problem with the first two is you are doing multiple operations, and the last is compare two things, then compare these two things, then compare these two things.

Logical operators can only work on two things at a time, and without an order of operation, it won't know what two to start with.

There may be a better way to denote the array you are comparing too, but I am not a coder, just a block diagramer when it comes to programs. Unless you have a router or switch that you need configured...

User avatar
Cathrine Jack
 
Posts: 3329
Joined: Sat Dec 02, 2006 1:29 am

Post » Sat May 18, 2013 1:48 pm

The first two do not work because you cannot 'assume' what is being compared. Papyrus is not an advanced programming language.

The last one works because you are explicitly listing which two items are being compared between your ||'s.

User avatar
Manuela Ribeiro Pereira
 
Posts: 3423
Joined: Fri Nov 17, 2006 10:24 pm


Return to V - Skyrim