I have a boolean variable isExists
. I need to check if isExists
is true then i have to perform some action otherwise i need to perform other action. I can write conditional code like following
approach-1
if(isExists){
//perform use previous interest
}else{
//create new interest
}
approach-2
if(true == isExists){
//perform use previous interest
}else{
//create new interest
}
In some books approach 2 is used and in others approach-1 is used.
What is the difference and which one is better between these two way of checking conditional statement for boolean