Page 101 - Digicode_AI_class_6
P. 101
Explanation:
You have enter the Number 15, which is not divisible by 2, so the control goes to 'if-else' block; and
the number is divisible by 3, so the 'if-else' block will execute and the output will be 'pink' color.
Jump Statements
While executing a program sometimes we need to change the flow of the program. To do so, we need
change the flow of control from one part of the program to another. For this we can use break and
continue statements.
While (Loop-Condition)
{
Statement 1;
Statement 2;
...........
Execution of the program
Break;
........... skips after the break
statement is encountered in
}
the loop body.
Statement
Break Statement
The break statement alters or change the normal flow of execution of the statement by terminating the
existing loop and continues the execution of the statement following that loop.
Break statement is used to come out of a loop early when the specific condition is met.
In break, the control skips the lines after the break statement is found and executes the first
statement outside the loop.
Example 1: Program to print number from 7 to 4, and another
Information Literacy
print statement when you encounter break.
Pseudocode:
Program Start
set value of a to 7
while the value of a is greater that 0
display 'Current variable is: ' value of a
decrease the value of a by 1
if value of a is equal to 4
break
display Bye!
Program End
Using MakeCode Arcade 99

