During programming in some cases to fulfill the logic I've left if block empty. Every time I feel that it is not good programming practice. there should be another way to fulfill the logic. My question is that have you ever write such code or what are you doing if such condition is there?
I'm providing following code. actually this code is for example purpose only to realize what kind of situation I am talking. My question is not for any particular programming language.
if(a+b==0){
//nothing to do to fulfill logic.
}
else if(a>b){
c=a*b;
}
else if(a<b){
c=a-b;
}
else{
c=a/b;
}
Aucun commentaire:
Enregistrer un commentaire