dimanche 5 mai 2019

Is there any cleaner way to write multiple if-statements in Java

I have an if-else structure in Java as follow:

                    if (A || B || C){
                        if (A){
                            //Do something
                        }
                        if (B){
                            //Do something
                        }
                        if (C){
                            //Do something
                        }
                    } else {
                        //Do something
                    }

I want to know if there is any cleaner and easier way to replace this?

Aucun commentaire:

Enregistrer un commentaire