samedi 18 février 2017

How to construct complex "if" statements

I am working on an android app which compares many random variables.

Collumn "A", for example has 4 variables, Collumn "B" has 4 variables... ect. There are 5 collumns total. The variables are random from a set of 5 numbers.

Right now I have about 100 if statements which are like:

If (a1==b1)
{If (b1==c1)

I list all possible outcomes... a1.equals b2 ect ect... I began rewriting it to use || but I am still coming out with thousands of lines of code and I often recieve errors. I've searched the web but I keep comming up with no results.

I guess what I am looking for is something like...

If ((a1||a2||a3||a4)==(b1||b2||b3||b4))
{ //check if ==(c1||c2||c3||c4) ect...}
Else

{Do something...}

I just consistently am getting compile errors and crashes whenever I write stuff like this. Also I cannot figure out how to check stuff like (a1&&a2)==(b1||b2) ect ect...

Any help or advice would be greatly appreciated Thanks!

Aucun commentaire:

Enregistrer un commentaire