I was wondering if there's any difference between these two codes:
Code 1:
if(isSleepy()){
sleep(1);
} else if (isBored()){
dance();
dance();
} else {
walkRight(50);
walkLeft(50);
if(isHungry()){
eat();
}
}
Code 2:
if(isSleepy()){
sleep(1);
}
if (isBored()){
dance();
dance();
}
walkRight(50);
walkLeft(50);
if(isHungry()){
eat();
}
I've replaced the if-elseif-if chain with if only. Does that affect the conditionnal process ?