Decision structures are also known as selection structures. Decision structures are used to perform an action if a certain condition is met. The decision structure’s syntax and usage can vary depending on the programming language being used, but the general idea remains the same: check for a condition and execute some code if it is met. In the first example, we are checking if a variable holds an even number. If it is true, then set its value to zero; otherwise leave it unchanged. Notice that you can use “&&” for AND statements or “||” for OR statements and they will work just as expected in this case. if ((num % num) == 0 && (num != 0)) { msg = ‘Number: ‘, num;} else{ msg = ”; } print(msg); // Number: 1234 The second example shows how to check two conditions at once using nested conditional structures and execute different code based on each condition’s result. In this case, when both of these conditions are met – tiggering the

LEAVE A REPLY

Please enter your comment!
Please enter your name here