SlideShare a Scribd company logo
Introduction to
Coding
Grade VI
Version 1.0
Ethical practices in
coding
• Contribute to society and human
well being
• Avoid harm to others
Chapter 1: Introduction to coding
At the end of this chapter, students should be able
to understand what coding is and how can we use
it to solve practical world problems. Students
will understand:
• Real world application of coding
• How coding impacts our daily lives?
• What exactly is coding in context of computer
science?
• Popular programming languages
How do traffic lights work?
Have you ever wondered how traffic signal's
function? The lights cycle through green, yellow
and red at regular intervals to control the flow the
traffic at road intersections. They prevent
accidents and help avoiding congestion on the
roads.
But how do the traffic lights change
automatically?
Few lines of code running on the background
drives the traffic lights. At regular intervals, the
code changes the traffic signals to show different
signals. Sometimes it is even more smart, where
the code detects congestion based on sensors and
maximize efficiency by only functioning when
traffic is present.
Where is coding
applied?
Most of us knowingly or unknowingly engage
with programming, be it inside our homes or
outside. Coding, in the modern world, can be
seen on the streets, at the schools, at the local
grocery store etc.
Where else is coding applied?
Interaction with bar-
code scanners at
shopping store
Automatic
control of traffic
using traffic
lights
Booking movie,
bus, train, flight
tickets online
Printers Computer software like
web browser, Word
etc.
Video games and
animations for
entertainment
What exactly is coding?
Coding, also referred to as programming, is
creating instructions that can be executed on a
computer to perform a specific task or achieve a
particular result.
What is a programming
language?
We can interact with computers via a language
that computers understand. This language is
called a programming language. Using
programming languages, we can provide
instructions to a computer to perform a set of
activities. These sets of instructions are also called
programs.
Popular programming
languages
• Python
• Java
• JavaScript
• C#
• R
• C++
• C
Chapter 2: Algorithms with block coding
By the end of this chapter, students will learn:
• What does the term algorithm mean?
• What is a flowchart?
• Applications of a flowchart
• Get introduced to pseudocode
• How to solve problems using pseudocode
What is an algorithm?
An algorithm is defined as the step-by-step plan to solve the problem for a
given problem statement.
Searching for a word in dictionary
Let’s say Mukesh is searching for the word ‘proxy’ in dictionary. To achieve this, he will
perform the following steps in order:
1. Find the dictionary section with the first letter of the word, which in this case is 'p.’
2. Then, within the list of words starting the first letter 'p', he needs to find the section having the
second letter of the word 'r’
3. Perform this operation again with the third, fourth & fifth letters until he finally reaches the word
'proxy’
This is an example of a simple algorithm.
What is a Flowchart?
A flowchart is a diagrammatic
representation of the step-by-step plan
to be followed for solving a task /
problem statement.
This diagrammatic representation is
made up of shapes like boxes,
diamonds, parallelograms, circles,
ellipses connected by arrows. Each
shape acts as a step in the solution and
the arrows represent the direction of
flow among the steps.
Symbols used in flowchart
Benefits of
using a
Flowchart?
• Flowchart helps to explain your approach
towards solving a problem
• The flowchart helps in bringing in visual
clarity to a problem, so it helps in
practical problem solving
• Once you build a flowchart, this remains
as documentation of the code you are
about to build. If you need to come back
and understand the code, you can refer
to the flowchart.
Are you a teenager?
This is an example of a flowchart
where you input your age and
different results are shown as an
output for the following scenario
If age<13 then Child
If age>=13 and age <=19 then
Teenager
If age>19 then Adult
What is a pseudocode
In computer science, pseudocode
is used to describe the steps
followed in an algorithm via simple
human-comprehensible language.
Thus, it has no syntax of any
programming language and can be
understood by a layman.
Here we have an example of a
pseudocode where we calculate if
you had profit or had loss.
Getting started with
block coding
• Microsoft MakeCode is a framework
for creating interactive and engaging
programming experiences for those
new to the world of programming.
• The main objective of MakeCode is
to bring programming to the
forefront in a way that is more
alluring and friendly. MakeCode
utilizes the blocks programming
model to let those who are new to
the world of programming and learn
coding concepts easily.
Chapter 3: Variables using block coding
By the end of this chapter, students will learn:
• What are variables?
• Why we need variables?
• How to name variables?
• How to use variables in block coding
What are variables?
In programming, variable is a packet
in which we can store data. These
packets can be named and referenced
and can be used to perform various
operations. If you want to perform a
mathematical operation, you can
declare two variables and perform the
mathematical operation on it.
Naming variables?
Every variable in a program is unique.
To identify these variables uniquely,
user needs to allocate them a unique
name. This name acts as an identifier
for that variable. In programming, a
user is not allowed to use the same
name of a variable more than once.
Naming variables make it to easier to
call them while performing
operations. The name of a variable
also suggests what information the
variable contains.
Different data types in variables
• Integer
• Floating-point number
• Character
• String
• Boolean
Integer data type
• Integer data type variables store
integer values only. They store whole
numbers which have zero, positive
and negative values but not decimal
values
• If a user tries to create an integer
variable and assign it a non-integer
value, the program returns an error
• Variables of the integer data type
are only capable of holding single
values
Example of declaring an Integer
variable:
int a = 2;
Floating point number
data type
• Floating-point numbers are used to
store decimal values. They hold real
numbers with decimal values
• There is another type of floating-
point number known as a "double"
data type, which is used to store
even bigger values
Example of declaring a floating-
point number variable:
float a = 1.1;
Example of a double value:
double a = 8.999999999;
Character data type
• Character type variables are used to
store character values
• If a user tries to create a character
variable and assign it with a non-
character value, the program will
throw an error
Example of declaring a character
variable:
char a = ‘w’;
Boolean data type
• There is a subtype of Integer Data
Type called "Boolean Data Type",
which stores values in Boolean type
only i.e., "true" or "false"
• Users can choose between the data
types for variables as per program
needs and assign variables an
appropriate data type
Example of declaring a Boolean
variable:
bool a = true;
Performing operations on variables
An arithmetic operation combines two or more numeric expressions using the
Arithmetic Operators to form a resulting numeric expression. The basic
operators for performing arithmetic are the same in many computer languages:
• Addition
• Subtraction
• Multiplication
• Division
• Modulus (Remainder)
Addition using block
coding
• An addition arithmetic operation is
used to add the values stored in two
variables. Like the way we add values
in mathematics, we can store values
in different variables and perform an
additional operation. The addition of
these variables is displayed as an
output of the program.
• For example, performing add
operation on a variable "a" holding
value "3" and a variable "b" holding
value "4" will result in an output "7".
Chapter 4: Control with conditionals
At the end of this this chapter, students will
understand logical operators in programming.
They will know:
• What are conditions and how to apply them in
real life?
• What are the different types of operators?
• How to combine multiple operators?
• Apply logical operations in block coding
Conditions in coding
In the image, we see several blocks
arranged in a specific order. Every
time we place a new block, we
apply logic so that we can build a
diagonal line with blocks marked
with arrows. These logic in coding
terms are called conditions.
What are logical
operators?
Logical operators are fundamental
blocks that can be used to build a
decision-making capability in your
code. There are three types of
logical operators:
• AND
• OR
• NOT
Three types of logical operators
We use the AND operator to check if two or more conditions are true. If
all the conditions are true, the AND operator returns TRUE. If any one of
the conditions fail, the AND operator returns FALSE
We use the OR operator to check if either one of two or more conditions
is TRUE. If any of the condition is true, the OR operator returns TRUE. If
all the conditions fail, the OR operator simply returns FALSE
We use the NOT operator to reverse or negate a condition. If the
condition is true, NOT will return false and vise-versa
AND Operator
AND operator is used to determine if
two or more conditions are true. If all
the conditions are true, the AND
operator returns TRUE. If any one of
the conditions fail, the AND operator
returns FALSE.
For example - you should go to bed
only after you have completed your
homework and the time is past 8 PM.
IF (Homework completed) AND
(Time is past 8 PM)
THEN
Go to bed
ELSE
Do not go to bed
END
OR Operator
The OR operator is used to determine
if either one of two or more conditions
is TRUE. If any of the condition is true,
the OR operator returns TRUE. If all
the conditions fail, the OR operator
simply returns FALSE.
For example - We should carry an
umbrella when either it is sunny, or it
is raining. Otherwise, we should not
carry it.
IF (It is sunny outside) OR (It is
raining outside)
THEN
Carry an umbrella
ELSE
Do not carry an umbrella
END
NOT Operator
We use the NOT operator to reverse or
negate a condition. If the condition is
true, NOT will return false and vice-
versa.
For example, you can go to play only if
it is not raining, otherwise, you must
stay indoors.
IF NOT (It is raining)
THEN
Go out to play
ELSE
Stay indoors
END
Combining logical operators
Sometimes, we need to combine
different logical operators to create
a complex expression.
Imagine your library is open on
Monday between 10 AM to 12 PM
OR on Wednesday between 3 PM to
5 PM.
Let's see how the pseudocode for
the scenario looks like
Different relational operators
Operator Symbol Example Meaning
Greater than > x > y x greater than y
Equal to == x == y x is equal to y
Less than < x < y x is less than y
Greater than or
equal to
>= x >= y x is greater than or equal
to y
Less than or equal to <= x <= y x is less than or equal to
y
Not equal to != x! = y x is not equal to y
Chapter 5: Loops using block coding
At the end of this chapter, students will know:
• What are loops?
• How to increment loops?
• Nested loops
• Applying loops in block coding
Introduction to loops
There are many tasks in our day-to-day life
which we repeat at specific intervals, like
eating meals, taking a bath, going to school
etc.
There is a very similar concept to this in
programming where we need to repeat
certain lines of code at specific interval or till
specified condition is met.
Increment loops
Loops provide the facility to execute a
block of code repetitively, based on a
condition. This block of code is
executed repeatedly till the time
specified condition remains true. This
condition is checked based on loop’s
control variable.
The following flowchart prints the
numbers 1 to 5. Here every time the
condition (Count < 5) is true, "Print
count" gets executed. So, we do not
have to write the "Print" statement
multiple times. Every loop must have
an exit condition. In our example the
exit condition is (Count > 5). The loop
will exit when the condition is false.
Different
types of
loops
Different types of loops continued..
While Loops
• The While loop can execute a set of commands till the condition is true
• While Loops are also called conditional loops
• Once the condition is met then the loop is finished
For Loops
For loop is needed for iterating over a sequence. A for loop executes for a specific
number of times.
Nested Loops
Any loop in program may contain another loop inside it. When there is a loop inside
another loop, it is called a nested loop.
Entry Criteria
• Entry criteria is defined as a condition that must be
met before starting a specific task. It is a set of
conditions that must exist before you can start a task.
These criteria differ from program to program as per
the requirement.
• For example, To start a car you need petrol/diesel. If
your fuel tank is empty your car won’t start. So, the
entry criteria for the car to start is fuel tank should
not be empty.
Exit Criteria
• Exit criteria is defined as condition which must be met before completing a
specific task. It is a predefined set of conditions that must exist before you can
declare a program to be complete.
• Exit criteria is one of the most important components while defining a loop. As
without an exit criterion, the program tends to enter in an infinite loop. These
criteria differ from program to program as per the requirement.
For example, while creating a loop to print numbers from 1 to 1000, exit criteria
is that loop should exit the block of code when the 1000th number is printed,
else the program will enter an infinite loop.
Break Statement
The break statement modifies the
normal flow of execution while it
terminates the existing loop and
continues execution of the
statement following that loop.
Let us now understand Break
Statement with help of pseudocode
Continue Statement
• Whenever a program comes across a
continue statement, the control skips
the execution of remaining statements
inside the loop for the current iteration
and jumps to the beginning of the loop
for the next iteration.
• If the loop's condition is still true, it
enters the loop again, else the control
will be moved to the statement
immediately after the loop.
Let us now understand continue
statements with pseudocode
Nested loops
Any loop in program may contain
another loop inside it. A loop inside
another loop is called a nested loop.
How it works is that first success
condition of outer loop triggers the
inner loop which runs and reaches
the completion. This combinations
of loops inside loop is helpful while
working with requirements where
user wants to work of multiple
conditions simultaneously.
Thank You

More Related Content

PPT
Logical functions in excel
PPTX
Unit 4 python -list methods
PPTX
Charts in Calc
PDF
C programming | Class 8 | III Term
PPTX
sSCOPE RESOLUTION OPERATOR.pptx
PPTX
Electricity and circuits
PPTX
Nature's treasure
PDF
Spreadsheet Date & Time Functions
Logical functions in excel
Unit 4 python -list methods
Charts in Calc
C programming | Class 8 | III Term
sSCOPE RESOLUTION OPERATOR.pptx
Electricity and circuits
Nature's treasure
Spreadsheet Date & Time Functions

What's hot (20)

PPTX
Chapter 02 functions -class xii
PPT
Chap3 flow charts
PPTX
Function in C program
PPTX
COMPONENTS OF FOOD - CLASS VI
PPTX
CBSE_Std_IX_Into_to_IT-ITeS.pptx
PPTX
Ms excel ppt
PPT
Class-7 science Chapter-2 Nutrition in animals
PPTX
Arrays in Java
PPTX
Class 7 Cyber toolsComputer NUMBER SYSTEM
PPTX
Present continuous negative statements
DOCX
Data Structure Project File
PPTX
Formulas and functions
PPTX
Window to Viewport Transformation in Computer Graphics with.pptx
PPTX
OPERATORS OF C++
PDF
PPT_X_IT-402_Electronic Spreadsheet.pptx.pdf
PPTX
Computer Graphics - Windowing and Clipping
PPTX
Getting to know plants
PPTX
Two-dimensional array in java
PDF
Data Structures Notes 2021
Chapter 02 functions -class xii
Chap3 flow charts
Function in C program
COMPONENTS OF FOOD - CLASS VI
CBSE_Std_IX_Into_to_IT-ITeS.pptx
Ms excel ppt
Class-7 science Chapter-2 Nutrition in animals
Arrays in Java
Class 7 Cyber toolsComputer NUMBER SYSTEM
Present continuous negative statements
Data Structure Project File
Formulas and functions
Window to Viewport Transformation in Computer Graphics with.pptx
OPERATORS OF C++
PPT_X_IT-402_Electronic Spreadsheet.pptx.pdf
Computer Graphics - Windowing and Clipping
Getting to know plants
Two-dimensional array in java
Data Structures Notes 2021
Ad

Similar to INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE (20)

PPTX
classVII_Coding_Teacher_Presentation.pptx
PPTX
Lec-ProblemSolving.pptx
PPTX
Learn to code in 15 minutes
PPT
programming language(C++) chapter-one contd.ppt
PPTX
Introduction to Coding
PPTX
INTROTOPROBLEMSOLVING.pptxINTROTOPROBLEMSOLVING.pptx
PPT
Introduction to Programming
PPT
computer programming introduction ppt.ppt
PPTX
Cs1123 2 comp_prog
PPT
Programming Fundamentals - Lecture 1.ppt
PPTX
Pseudo code
PPTX
class 4 5.pptx scrach coding full explain
PPTX
intro ai,coding and robotics.pptx scratch
PPTX
intro ai,coding and robotics.pptx scratch
PPT
Chapter 5( programming) answer
PDF
Introduction to programming by MUFIX Commnity
PDF
Introduction To Programming (2009 2010)
PDF
Introduction to programming : flowchart, algorithm
PPTX
Fundamentals Topic 1 Programming basics.pptx
PPT
Introduction To Programming
classVII_Coding_Teacher_Presentation.pptx
Lec-ProblemSolving.pptx
Learn to code in 15 minutes
programming language(C++) chapter-one contd.ppt
Introduction to Coding
INTROTOPROBLEMSOLVING.pptxINTROTOPROBLEMSOLVING.pptx
Introduction to Programming
computer programming introduction ppt.ppt
Cs1123 2 comp_prog
Programming Fundamentals - Lecture 1.ppt
Pseudo code
class 4 5.pptx scrach coding full explain
intro ai,coding and robotics.pptx scratch
intro ai,coding and robotics.pptx scratch
Chapter 5( programming) answer
Introduction to programming by MUFIX Commnity
Introduction To Programming (2009 2010)
Introduction to programming : flowchart, algorithm
Fundamentals Topic 1 Programming basics.pptx
Introduction To Programming
Ad

Recently uploaded (20)

PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Open folder Downloads.pdf yes yes ges yes
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PDF
Basic Mud Logging Guide for educational purpose
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Introduction-to-Social-Work-by-Leonora-Serafeca-De-Guzman-Group-2.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
human mycosis Human fungal infections are called human mycosis..pptx
Open Quiz Monsoon Mind Game Prelims.pptx
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
STATICS OF THE RIGID BODIES Hibbelers.pdf
Open Quiz Monsoon Mind Game Final Set.pptx
O7-L3 Supply Chain Operations - ICLT Program
Renaissance Architecture: A Journey from Faith to Humanism
Abdominal Access Techniques with Prof. Dr. R K Mishra
Open folder Downloads.pdf yes yes ges yes
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
The Final Stretch: How to Release a Game and Not Die in the Process.
Basic Mud Logging Guide for educational purpose
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPH.pptx obstetrics and gynecology in nursing
Introduction-to-Social-Work-by-Leonora-Serafeca-De-Guzman-Group-2.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx

INTRODUCTION TO CODING-CLASS VI LEVEL-DESCRIPTION ABOUT SYNTAX LANGUAGE

  • 2. Ethical practices in coding • Contribute to society and human well being • Avoid harm to others
  • 3. Chapter 1: Introduction to coding At the end of this chapter, students should be able to understand what coding is and how can we use it to solve practical world problems. Students will understand: • Real world application of coding • How coding impacts our daily lives? • What exactly is coding in context of computer science? • Popular programming languages
  • 4. How do traffic lights work? Have you ever wondered how traffic signal's function? The lights cycle through green, yellow and red at regular intervals to control the flow the traffic at road intersections. They prevent accidents and help avoiding congestion on the roads. But how do the traffic lights change automatically? Few lines of code running on the background drives the traffic lights. At regular intervals, the code changes the traffic signals to show different signals. Sometimes it is even more smart, where the code detects congestion based on sensors and maximize efficiency by only functioning when traffic is present.
  • 5. Where is coding applied? Most of us knowingly or unknowingly engage with programming, be it inside our homes or outside. Coding, in the modern world, can be seen on the streets, at the schools, at the local grocery store etc.
  • 6. Where else is coding applied? Interaction with bar- code scanners at shopping store Automatic control of traffic using traffic lights Booking movie, bus, train, flight tickets online Printers Computer software like web browser, Word etc. Video games and animations for entertainment
  • 7. What exactly is coding? Coding, also referred to as programming, is creating instructions that can be executed on a computer to perform a specific task or achieve a particular result. What is a programming language? We can interact with computers via a language that computers understand. This language is called a programming language. Using programming languages, we can provide instructions to a computer to perform a set of activities. These sets of instructions are also called programs.
  • 8. Popular programming languages • Python • Java • JavaScript • C# • R • C++ • C
  • 9. Chapter 2: Algorithms with block coding By the end of this chapter, students will learn: • What does the term algorithm mean? • What is a flowchart? • Applications of a flowchart • Get introduced to pseudocode • How to solve problems using pseudocode
  • 10. What is an algorithm? An algorithm is defined as the step-by-step plan to solve the problem for a given problem statement. Searching for a word in dictionary Let’s say Mukesh is searching for the word ‘proxy’ in dictionary. To achieve this, he will perform the following steps in order: 1. Find the dictionary section with the first letter of the word, which in this case is 'p.’ 2. Then, within the list of words starting the first letter 'p', he needs to find the section having the second letter of the word 'r’ 3. Perform this operation again with the third, fourth & fifth letters until he finally reaches the word 'proxy’ This is an example of a simple algorithm.
  • 11. What is a Flowchart? A flowchart is a diagrammatic representation of the step-by-step plan to be followed for solving a task / problem statement. This diagrammatic representation is made up of shapes like boxes, diamonds, parallelograms, circles, ellipses connected by arrows. Each shape acts as a step in the solution and the arrows represent the direction of flow among the steps.
  • 12. Symbols used in flowchart
  • 13. Benefits of using a Flowchart? • Flowchart helps to explain your approach towards solving a problem • The flowchart helps in bringing in visual clarity to a problem, so it helps in practical problem solving • Once you build a flowchart, this remains as documentation of the code you are about to build. If you need to come back and understand the code, you can refer to the flowchart.
  • 14. Are you a teenager? This is an example of a flowchart where you input your age and different results are shown as an output for the following scenario If age<13 then Child If age>=13 and age <=19 then Teenager If age>19 then Adult
  • 15. What is a pseudocode In computer science, pseudocode is used to describe the steps followed in an algorithm via simple human-comprehensible language. Thus, it has no syntax of any programming language and can be understood by a layman. Here we have an example of a pseudocode where we calculate if you had profit or had loss.
  • 16. Getting started with block coding • Microsoft MakeCode is a framework for creating interactive and engaging programming experiences for those new to the world of programming. • The main objective of MakeCode is to bring programming to the forefront in a way that is more alluring and friendly. MakeCode utilizes the blocks programming model to let those who are new to the world of programming and learn coding concepts easily.
  • 17. Chapter 3: Variables using block coding By the end of this chapter, students will learn: • What are variables? • Why we need variables? • How to name variables? • How to use variables in block coding
  • 18. What are variables? In programming, variable is a packet in which we can store data. These packets can be named and referenced and can be used to perform various operations. If you want to perform a mathematical operation, you can declare two variables and perform the mathematical operation on it.
  • 19. Naming variables? Every variable in a program is unique. To identify these variables uniquely, user needs to allocate them a unique name. This name acts as an identifier for that variable. In programming, a user is not allowed to use the same name of a variable more than once. Naming variables make it to easier to call them while performing operations. The name of a variable also suggests what information the variable contains.
  • 20. Different data types in variables • Integer • Floating-point number • Character • String • Boolean
  • 21. Integer data type • Integer data type variables store integer values only. They store whole numbers which have zero, positive and negative values but not decimal values • If a user tries to create an integer variable and assign it a non-integer value, the program returns an error • Variables of the integer data type are only capable of holding single values Example of declaring an Integer variable: int a = 2;
  • 22. Floating point number data type • Floating-point numbers are used to store decimal values. They hold real numbers with decimal values • There is another type of floating- point number known as a "double" data type, which is used to store even bigger values Example of declaring a floating- point number variable: float a = 1.1; Example of a double value: double a = 8.999999999;
  • 23. Character data type • Character type variables are used to store character values • If a user tries to create a character variable and assign it with a non- character value, the program will throw an error Example of declaring a character variable: char a = ‘w’;
  • 24. Boolean data type • There is a subtype of Integer Data Type called "Boolean Data Type", which stores values in Boolean type only i.e., "true" or "false" • Users can choose between the data types for variables as per program needs and assign variables an appropriate data type Example of declaring a Boolean variable: bool a = true;
  • 25. Performing operations on variables An arithmetic operation combines two or more numeric expressions using the Arithmetic Operators to form a resulting numeric expression. The basic operators for performing arithmetic are the same in many computer languages: • Addition • Subtraction • Multiplication • Division • Modulus (Remainder)
  • 26. Addition using block coding • An addition arithmetic operation is used to add the values stored in two variables. Like the way we add values in mathematics, we can store values in different variables and perform an additional operation. The addition of these variables is displayed as an output of the program. • For example, performing add operation on a variable "a" holding value "3" and a variable "b" holding value "4" will result in an output "7".
  • 27. Chapter 4: Control with conditionals At the end of this this chapter, students will understand logical operators in programming. They will know: • What are conditions and how to apply them in real life? • What are the different types of operators? • How to combine multiple operators? • Apply logical operations in block coding
  • 28. Conditions in coding In the image, we see several blocks arranged in a specific order. Every time we place a new block, we apply logic so that we can build a diagonal line with blocks marked with arrows. These logic in coding terms are called conditions.
  • 29. What are logical operators? Logical operators are fundamental blocks that can be used to build a decision-making capability in your code. There are three types of logical operators: • AND • OR • NOT
  • 30. Three types of logical operators We use the AND operator to check if two or more conditions are true. If all the conditions are true, the AND operator returns TRUE. If any one of the conditions fail, the AND operator returns FALSE We use the OR operator to check if either one of two or more conditions is TRUE. If any of the condition is true, the OR operator returns TRUE. If all the conditions fail, the OR operator simply returns FALSE We use the NOT operator to reverse or negate a condition. If the condition is true, NOT will return false and vise-versa
  • 31. AND Operator AND operator is used to determine if two or more conditions are true. If all the conditions are true, the AND operator returns TRUE. If any one of the conditions fail, the AND operator returns FALSE. For example - you should go to bed only after you have completed your homework and the time is past 8 PM. IF (Homework completed) AND (Time is past 8 PM) THEN Go to bed ELSE Do not go to bed END
  • 32. OR Operator The OR operator is used to determine if either one of two or more conditions is TRUE. If any of the condition is true, the OR operator returns TRUE. If all the conditions fail, the OR operator simply returns FALSE. For example - We should carry an umbrella when either it is sunny, or it is raining. Otherwise, we should not carry it. IF (It is sunny outside) OR (It is raining outside) THEN Carry an umbrella ELSE Do not carry an umbrella END
  • 33. NOT Operator We use the NOT operator to reverse or negate a condition. If the condition is true, NOT will return false and vice- versa. For example, you can go to play only if it is not raining, otherwise, you must stay indoors. IF NOT (It is raining) THEN Go out to play ELSE Stay indoors END
  • 34. Combining logical operators Sometimes, we need to combine different logical operators to create a complex expression. Imagine your library is open on Monday between 10 AM to 12 PM OR on Wednesday between 3 PM to 5 PM. Let's see how the pseudocode for the scenario looks like
  • 35. Different relational operators Operator Symbol Example Meaning Greater than > x > y x greater than y Equal to == x == y x is equal to y Less than < x < y x is less than y Greater than or equal to >= x >= y x is greater than or equal to y Less than or equal to <= x <= y x is less than or equal to y Not equal to != x! = y x is not equal to y
  • 36. Chapter 5: Loops using block coding At the end of this chapter, students will know: • What are loops? • How to increment loops? • Nested loops • Applying loops in block coding
  • 37. Introduction to loops There are many tasks in our day-to-day life which we repeat at specific intervals, like eating meals, taking a bath, going to school etc. There is a very similar concept to this in programming where we need to repeat certain lines of code at specific interval or till specified condition is met.
  • 38. Increment loops Loops provide the facility to execute a block of code repetitively, based on a condition. This block of code is executed repeatedly till the time specified condition remains true. This condition is checked based on loop’s control variable. The following flowchart prints the numbers 1 to 5. Here every time the condition (Count < 5) is true, "Print count" gets executed. So, we do not have to write the "Print" statement multiple times. Every loop must have an exit condition. In our example the exit condition is (Count > 5). The loop will exit when the condition is false.
  • 40. Different types of loops continued.. While Loops • The While loop can execute a set of commands till the condition is true • While Loops are also called conditional loops • Once the condition is met then the loop is finished For Loops For loop is needed for iterating over a sequence. A for loop executes for a specific number of times. Nested Loops Any loop in program may contain another loop inside it. When there is a loop inside another loop, it is called a nested loop.
  • 41. Entry Criteria • Entry criteria is defined as a condition that must be met before starting a specific task. It is a set of conditions that must exist before you can start a task. These criteria differ from program to program as per the requirement. • For example, To start a car you need petrol/diesel. If your fuel tank is empty your car won’t start. So, the entry criteria for the car to start is fuel tank should not be empty.
  • 42. Exit Criteria • Exit criteria is defined as condition which must be met before completing a specific task. It is a predefined set of conditions that must exist before you can declare a program to be complete. • Exit criteria is one of the most important components while defining a loop. As without an exit criterion, the program tends to enter in an infinite loop. These criteria differ from program to program as per the requirement. For example, while creating a loop to print numbers from 1 to 1000, exit criteria is that loop should exit the block of code when the 1000th number is printed, else the program will enter an infinite loop.
  • 43. Break Statement The break statement modifies the normal flow of execution while it terminates the existing loop and continues execution of the statement following that loop. Let us now understand Break Statement with help of pseudocode
  • 44. Continue Statement • Whenever a program comes across a continue statement, the control skips the execution of remaining statements inside the loop for the current iteration and jumps to the beginning of the loop for the next iteration. • If the loop's condition is still true, it enters the loop again, else the control will be moved to the statement immediately after the loop. Let us now understand continue statements with pseudocode
  • 45. Nested loops Any loop in program may contain another loop inside it. A loop inside another loop is called a nested loop. How it works is that first success condition of outer loop triggers the inner loop which runs and reaches the completion. This combinations of loops inside loop is helpful while working with requirements where user wants to work of multiple conditions simultaneously.

Editor's Notes

  • #3: Contribute to society and human well being Students must limit negative results of software, including dangers to safety, health, personal security, and privacy Do consider the aftereffects of the software. Ensure your Code respects diversity and is utilized responsibly with social issues in mind In addition to this, promote environmental sustainability both locally and globally Avoid harm to others Students’ code should not cause physical or mental injury, unjustified destruction to property or information Avoid unjustified damage to reputation and environment
  • #4: The teacher should introduce coding and its applications to students. The teacher can explain it using relatable examples to students. They can also ask the students to come up with such examples to encourage critical thinking.
  • #5: This is an example of the real application of coding
  • #6: The teacher can ask the students to give few examples of real life applications of coding
  • #7: The teacher should discuss these examples of coding which are used in our day-to-day life 
  • #12: The teacher should introduce flowcharts to the students by using real-life examples. They can also ask the students to produce few examples to encourage critical thinking.
  • #16: The teacher should introduce pseudocode to the students by using real-life examples . They should make sure that the children are not confused with these terms and explain the pseudocode to the students to improve their conceptual understanding
  • #17: For the exercise , the teacher should make sure that the children are comfortable with the MakeCode platform and they have it working on their computers. The practice challenges can be solved in several ways and do not have a definite answer.
  • #19: The teacher should introduce variable to the students by using real-life examples. They can also ask the students to come up with such examples to encourage critical thinking.
  • #20: The teacher should introduce variable to the students by using real-life examples. They can also ask the students to come up with such examples to encourage critical thinking.
  • #21: The teacher should ask the students to write examples using different types of variables and use them in their code.
  • #26: The teacher can show the students on how to use different operations on variables in their code
  • #27: For the exercise , the teacher should make sure that the children are comfortable with the MakeCode platform and they have it working on their computers. The practice challenges can be solved in several ways and do not have a definite answer.
  • #31: The teacher should introduce AND, OR and NOT operators with examples. They should ensure that the children are not confused with these terms and explain the pseudo code to the students to improve their conceptual understanding.
  • #32: The teacher should explain this concept to the students using various examples so that the students are comfortable with this concept.
  • #35: Combining operators should be explained with the flowcharts provided. The teacher can also ask students to draw a few flowcharts on their own to test their understanding. Students might be familiar with relational operators already, so using them in examples and pseudo code should be helpful.
  • #36: The teacher should introduce relational operators with examples. They should ensure that the children are not confused with these operators and learn how to use them in programming.
  • #38: The teacher should introduce loops to the students by using real-life examples to make it more understandable to students. They can also ask the students to come up with such examples to encourage critical thinking.
  • #39: The teacher should explain this concept to the students using examples
  • #41: The teacher should explain this concept to the students using examples