Structured Programming
Structured Programming
1. History
2. Overview
3. Component
4. Representations in different languages(C, C++, Java, Python)
1. History
The Böhm-Jacopini theorem, also called structured program
theorem, combining subprograms in only three manners:
Executing one subprogram, and the other subprogram
(sequence) .
Executing one of two subprograms according to the value of a
Boolean expression (selection) .
Executing a subprogram until a Boolean expression is true
(iteration)
Some of the languages that initially used structured approach are
ALGOL, Pascal, PL/I and Ada.
if statement :
It is used to decide whether a certain statement or block of statements will be
executed or not i.e if a certain condition is true then a block of statement is executed
otherwise not.
Syntax:
if condition:
# Statements to execute if
# condition is true
Example :
i = 10
if (i > 15):
print ("10 is less than 15")
print ("I am Not in if”)
if..else statements:
We can use the else statement with if statement to execute a block of code when the condition is false.
Syntax:
if (condition):
else:
Example :
i = 20;
if (i < 15):
else: