![]() ![]() The nested if.else statement allows you to check for multiple test expressions and execute different codes for more than two conditions. Sometimes, a choice has to be made from more than 2 possibilities. The if.else statement executes two different codes depending upon whether the test expression is true or false. If the value of expression is nonzero, statement1 and any other statements in the block are executed and the else-block, if present, is skipped. Statements in the if-block are executed only if the if-expression evaluates to a non-zero value (or TRUE). If-else Statement (C) Controls conditional branching. C: If and Else Statements So we've learnt how to collect basic data from the user, but wouldn't it be useful if we could do different things depending on what the user typed in? Well this happens to be a very core concept of computer programming, and we can do exactly as previously described with these things called 'if' statements. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
February 2023
Categories |