3. Decision Making
To implement a specific logic, one must take many
small decisions to make it happen.
Shopping examples.
4. Decision Making
To ensure right choice and decision one uses
if and else statement.
5. IF
It is a single selection statement. Which provides us
to code what should happen when specific condition
occurs.
Like you want your program to print anything if a=2
then it will be like
If(a==2)
Print “hello”
6. IF
Real time example
If your friend is coming over “then”
you will make pasta.
if( friend is coming)
make pasta;
7. IF-else Double Selection Statement
If decides what should happen if specific situation
happens.
Else decide what should happen if that situation
doesn’t occur
8. IF-Else Example
Like if you want to print some thing if a=2 and else
you want a=0
Like
if(a==2)
Print “hello”
Else
a=0
9. Real Life Example
Like if your friends are coming over then you would
make pasta otherwise you would make sandwiches
If(friends coming)
make pasta
Else
make sandwiches