Control Structures

सामान्य तौर पर, Control Statement Programs के Control Flow में मदद करते हैं। Control Flow वह क्रम है जिसमें Statements Executes होते हैं। उदाहरण के लिए, Program का Flow आमतौर पर Top to Bottom (Sequential flow) होता है, लेकिन क्या होगा यदि हम Code के एक Particular Block को केवल तभी Execute करना चाहते हैं जब यह एक Specific Condition को Fulfills करता है या Code के एक Block को एक Specified Number में Run चाहता है। Statements एक Program के smooth and intentional flow को सुनिश्चित करेंगे।
There are three types of control statements :
1. Conditional/Selection Statements
2. Iteration/Loop Statements
3. Jump Statements

Conditional/Selection Statements
ये Control Statement एक Program में निर्णय लेने को Implement करने में मदद करते हैं। एक Conditional Statement Block OF Statement का Selection करेगा जो दी गई Condition के आधार पर Execute होगा। Program का Result Condition पर निर्भर करता है।

यदि Given Condition होती है, तो Result 1 होता है; यदि यह False होता है, तो Result 0 होता है। जब कोई Truth Value होता है, तो Code Execute हो जाएगा;Otherwise, It Will Not.

Iteration/Looping Statement:
Iterative Statements को Repetitive Statements या Looping Statements के रूप में भी जाना जाता है। Looping Statements का उपयोग तब किया जाता है जब Program को Statement के Execution (या Repeated Execution of a Set of Statements) की आवश्यकता होती है, जब तक कि Loop Termination के लिए कुछ Condition Satisfied नहीं हो जाती।
There Are Two Types of Loops:
1. For Loop
2. while Lop
NOTE: Unlike other languages (like Java, C++, and C), Python does not have the do-while loop.

Jump Statements:
Jump Statements ऐसे Statements होते हैं जिनके जरिए हम Program में कहीं भी Control Transfer कर सकते हैं। ये Statements उन Statements को छोड़ कर Program Control को Transfer कर देंगे जिनमें कोई Specified Conditions नहीं हैं।
These Statements are :
1. Break
2. Continue
3. Pass

Previous articleMS Word : Character Paragraph Formatting Automatic Formatting and style & Inserting and Removing Page Beaks, Header and Footer
Next articlePointers and constants

LEAVE A REPLY

Please enter your comment!
Please enter your name here