What Is The Structure Of Selection In Programming

download.jpg

The Election Structure is a program structure that performs the testing process to take a decision whether a row or block of instructions will be processed or not. Testing this condition is done to select one of several available alternatives.
The decision-making process is actually only fixed on the logic of right or wrong, yes or no. Therefore, to determine a certain condition whether right or wrong, yes or no, it requires an understanding of the operations used in decision making. Among them are the operation of relations and logic.

Forms branching instructions

IF instructions
This instruction is used to check a condition and execute one instruction or instruction block, if and only if the condition is satisfied.

The codenya form:
statement_Aif (condition) then (statement1) (statement2) (statement) endifper statement_B

IF-ELSE Instructions
This instruction is used to determine the action to be used if the condition is true, and if the value is wrong.

The form of its code:

statement_Aif (condition) then (statement1) else (statement2) endifper statement_B

Nested IF Instructions
It is an if statement with another if if statement in the previous if.

The form of its code:

statement_Aif (condition_1) then (statement1) else if (condition_2) then (statement2) else (statement3) endifper statement_B

Instructions SWITCH,
It is a statement that is used to determine the choice of a number of (so many) options involved.

the codenya form:

switch (option) case (option_1): (action_1) case (option_2): (action_2) case (option_n): (action_n) endcase