Differences between If, Else and Elif

--Originally published at Introduction of Programming

To understand the conditional, first we have to know what is a control flow. normally it follows a linear path.

Conditionals introduce a branch in the control flow, when you make an “If” it will ask if its true or false, depending on the result it will follow a path.

else is another statement inside the “If”, it will optimize your program in order to do not write again the “If” conditional.

“Else” allows you to follow a path when the main statement is false, so your program will continue.

 

fqjobus