Continuing the previous post of Selection Structure, here I am going to advance the Selection structure by including if/else if and then if / else if /else constructs as well.
In simple if statement, a block of code may or may not get executed depending upon the condition set. In the if/else structure, choice is available between two code blocks, your program must execute one of the two code blocks, either within if or within the else construct.
You can also extend the if/else structure by using the if / else if construct. This allows you to specify multiple code blocks each with a condition that must evaluate to true or false. As soon as one of the conditions is satisfied, the code block is executed and rest of the blocks are all skipped. Read more of this post
Recent Comments