IEO Level 2- English Olympiad (SOF) Class 9 Coaching Programs
β³ π― Online Tests (2 Tests [50 Questions Each]): NTA Pattern, Analytics & Explanations
Click Here to View & Get Complete Material
Rs. 200.00
3 Year Validity (Multiple Devices)
π Study Material (303 Notes): 2024-2025 Syllabus
Click Here to View & Get Complete Material
Rs. 450.00
3 Year Validity (Multiple Devices)
π― 250 MCQs (& PYQs) with Full Explanations (2024-2025 Exam)
Click Here to View & Get Complete Material
Rs. 200.00
3 Year Validity (Multiple Devices)
Control Statements: Introduction, Objectives and Statements, Compound Statement and Null Statement
Introduction
- The normal flow of execution in a high-level language is sequential, i.e.. , each statement is executed in the order of its appearance in the program.
- Control statements enable us to specify the flow of program control, i.e.. , the order in which the instructions in a program must be executed.
- They make it possible to make decisions, to perform tasks repeatedly or to jump from one section of code to another.
- The statements which specify the order of execution of statements are called control flow statements.
- There are many control flow statements provided in C ++ that will be discussed in this lesson.
Objectives
Statements
Statements are the instructions given to the computer to perform any kind of action. Action may be in the form of data movement, decision making etc. Statements form the smallest executable unit within a C ++ program. Statements are always terminated by semicolon.
Compound Statement
- A compound statement is a grouping of statements in which each individual statement ends with a semi-colon.
- The group of statements is called block. Compound statements are enclosed between the pair of braces ( {} ) .
- The opening brace ( {) signifies the beginning and closing brace (} ) signifies the end of the block.
Null Statement
- Writing only a semicolon indicates a null statement.
- Thus β;β is a null or empty statement.
- This is quite useful when the syntax of the language needs to specify a statement, but the logic of the program does not need any statement.
- This statement is generally used in for and while looping statements.