SlideShare une entreprise Scribd logo
1  sur  41
TRIVUz Academy

                             PF02
                 Class Id:




Programming Fundamentals
                              MS Alam TRIVUz
                                 Founder, TRIVUz Network
TRIVUz Academy
TRIVUz Academy




Recap PF01



             TRIVUz Academy
We learn before
                           We Define Computer & Program

                           Define Computer Programming

                                   Programming Process

                                 Programming Language

                                         Inputs & Outputs

                                Define Logical Processing

                                               Variables

                                              Data Types
Programming Fundamentals


 TRIVUz Academy

                                    www.trivuzacademy.com
We will learn today
                                  Conditional Statement

                                        If… then … else

                                       Switch statement

                                             Operators




Programming Fundamentals


 TRIVUz Academy
www.trivuzacademy.com
Conditional Statement
• Conditional statements are the set of
  command used to perform different
  actions base on different conditions
• In PHP we have the following conditional
  statements:
   • if
   • if else
   • else if
   • switch


                               TRIVUz Academy
If statement
        execute some code only if statement is true




TRIVUz Academy
If…




TRIVUz Academy
If…
  if




TRIVUz Academy
If…
  if (conditional)




TRIVUz Academy
If…
  if (conditional) {




TRIVUz Academy
If…
  if (conditional) {
   // statement to be executed




TRIVUz Academy
If…
  if (conditional) {
   // statement to be executed
  }




TRIVUz Academy
If…
  Example:

  if ($math < 33) {
    $result = “Failed!”;
  }




TRIVUz Academy
If…else statement
          execute some code if statement is true
         and some other code if statement is false




TRIVUz Academy
If…else…
  if (conditional) {
   // statement if true
  }




TRIVUz Academy
If…else…
  if (conditional) {
   // statement if true
  } else




TRIVUz Academy
If…else…
  if (conditional) {
   // statement if true
  } else {
   // statement if false




TRIVUz Academy
If…else…
  if (conditional) {
   // statement if true
  } else {
   // statement if false
  }




TRIVUz Academy
If…else…
  Example:

  if ($math < 33) {
    $result = “Failed!”;
  } else {
    $result = “Passed!”;
  }




TRIVUz Academy
If…else if…else statement
          execute some code if statement is true
         And some other code if statement is false




TRIVUz Academy
If…else if…else
  if (conditional) {
   // statement if true
  } else if (conditional){
   // statement if false and else if true
  } else {
   // statement if all false
  }


TRIVUz Academy
If…else if…else
      if (conditional) {
         // statement if true
       } else if (conditional){
         // whichever matches first
       } else if (conditional){
         // whichever matches first
       } else if (conditional){
         // whichever matches first
       } else if (conditional){
         // whichever matches first
       } else {
         // statement if all false
      }

TRIVUz Academy
If…else if…else
  Example:

    if ($avg > 100) {
        $grade = "Invalid";
    }
    else if ($avg > 90 and $avg < 100 ) {
        $grade = "A+";
    }
    else if($avg > 80 and $avg < 90) {
        $grade = "A";
    }
    else {
        $grade = "F";
    }

TRIVUz Academy
switch statement
       Select one of many block of code to execute




TRIVUz Academy
switch
  switch




TRIVUz Academy
switch
  switch (value)




TRIVUz Academy
switch
  switch (value) {




TRIVUz Academy
switch
  switch (value) {
   case 1:
    // some code to execute




TRIVUz Academy
switch
  switch (value) {
   case 1:
    // some code to execute
    break;




TRIVUz Academy
switch
  switch (value) {
   case 1:
    // some code to execute
    break;
   case 2:
    // some code to execute
    break;



TRIVUz Academy
switch
  switch (value) {
   case 1:
    // some code to execute
    break;
   case 2:
    // some code to execute
    break;
   default:
    // nothing matches, do it

TRIVUz Academy
switch
  switch (value) {
   case 1:
    // some code to execute
    break;
   case 2:
    // some code to execute
    break;
   default:  similar to else in if..else
    // nothing matches, do it

TRIVUz Academy
switch
  switch (value) {
    case 1:
     // some code to execute
     break;
    case 2:
     // some code to execute
     break;
    default:
     // nothing matches, do it
  }
TRIVUz Academy
switch
switch (n)
{
case label1:
  code to be executed if n=label1;
  break;
case label2:
  code to be executed if n=label2;
  break;
default:
  code to be executed if n is different from both label1
and label2;
}

                                          TRIVUz Academy
switch
<html>
<body>
<?php
    switch ($x)
    {
      case 1:
        echo "Number 1";
      break;
      case 2:
        echo "Number 2";
      break;
      case 3:
        echo "Number 3";
      break;
      default:
        echo "No number between 1 and 3";
   }
?>
</body>
                                            TRIVUz Academy
</html>
PHP Operators
         Operators are used to operate on values




TRIVUz Academy
Operators
Arithmetic Operators




            TRIVUz Academy
Operators
Assignment Operators




             TRIVUz Academy
Operators
Comparison Operators




             TRIVUz Academy
Operators
Logical Operators




         TRIVUz Academy
Thank You



            MS Alam TRIVUz
            Founder,
            TRIVUz Academy
            trivuz@gmail.com

Contenu connexe

Tendances

Exception handling
Exception handlingException handling
Exception handlingzindadili
 
Exception Handling in object oriented programming using C++
Exception Handling in object oriented programming using C++Exception Handling in object oriented programming using C++
Exception Handling in object oriented programming using C++Janki Shah
 
Java Decision Control
Java Decision ControlJava Decision Control
Java Decision ControlJayfee Ramos
 
Cse lecture-6-c control statement
Cse lecture-6-c control statementCse lecture-6-c control statement
Cse lecture-6-c control statementFarshidKhan
 
Constructs (Programming Methodology)
Constructs (Programming Methodology)Constructs (Programming Methodology)
Constructs (Programming Methodology)Jyoti Bhardwaj
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C pptMANJUTRIPATHI7
 
Looping and Switchcase BDCR
Looping and Switchcase BDCRLooping and Switchcase BDCR
Looping and Switchcase BDCRberiver
 
Exception handling c++
Exception handling c++Exception handling c++
Exception handling c++Jayant Dalvi
 
Jumping statements
Jumping statementsJumping statements
Jumping statementsSuneel Dogra
 
Exception handling in c++
Exception handling in c++Exception handling in c++
Exception handling in c++imran khan
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__elseeShikshak
 
Chapter 8 - Conditional Statement
Chapter 8 - Conditional StatementChapter 8 - Conditional Statement
Chapter 8 - Conditional StatementDeepak Singh
 
Vb decision making statements
Vb decision making statementsVb decision making statements
Vb decision making statementspragya ratan
 

Tendances (20)

Statements and Conditions in PHP
Statements and Conditions in PHPStatements and Conditions in PHP
Statements and Conditions in PHP
 
09 ruby if else
09 ruby if else09 ruby if else
09 ruby if else
 
Exception handling
Exception handlingException handling
Exception handling
 
Exception Handling in object oriented programming using C++
Exception Handling in object oriented programming using C++Exception Handling in object oriented programming using C++
Exception Handling in object oriented programming using C++
 
Java Decision Control
Java Decision ControlJava Decision Control
Java Decision Control
 
M C6java6
M C6java6M C6java6
M C6java6
 
Cse lecture-6-c control statement
Cse lecture-6-c control statementCse lecture-6-c control statement
Cse lecture-6-c control statement
 
Constructs (Programming Methodology)
Constructs (Programming Methodology)Constructs (Programming Methodology)
Constructs (Programming Methodology)
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
 
Looping and Switchcase BDCR
Looping and Switchcase BDCRLooping and Switchcase BDCR
Looping and Switchcase BDCR
 
Exception handling c++
Exception handling c++Exception handling c++
Exception handling c++
 
Using loops
Using loopsUsing loops
Using loops
 
Iteration Statement in C++
Iteration Statement in C++Iteration Statement in C++
Iteration Statement in C++
 
Jumping statements
Jumping statementsJumping statements
Jumping statements
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
 
Exception handling in c++
Exception handling in c++Exception handling in c++
Exception handling in c++
 
Exception handling
Exception handlingException handling
Exception handling
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__else
 
Chapter 8 - Conditional Statement
Chapter 8 - Conditional StatementChapter 8 - Conditional Statement
Chapter 8 - Conditional Statement
 
Vb decision making statements
Vb decision making statementsVb decision making statements
Vb decision making statements
 

En vedette

Conditional Statements | If-then Statements
Conditional Statements | If-then StatementsConditional Statements | If-then Statements
Conditional Statements | If-then Statementssheisirenebkm
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statementsmicdsram
 
Conditional statement
Conditional statementConditional statement
Conditional statementMaxie Santos
 
Octal and Hexadecimal Numbering Systems
Octal and Hexadecimal Numbering SystemsOctal and Hexadecimal Numbering Systems
Octal and Hexadecimal Numbering SystemsLeo Hernandez
 
Binary octal
Binary octalBinary octal
Binary octaldrdipo4
 
1.3.2 Conditional Statements
1.3.2 Conditional Statements1.3.2 Conditional Statements
1.3.2 Conditional Statementssmiller5
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statementselissamiller
 
Using the IF Function in Excel
Using the IF Function in ExcelUsing the IF Function in Excel
Using the IF Function in ExcelCasey Robertson
 
11 octal number system
11   octal number system11   octal number system
11 octal number systemLee Chadwick
 
1st Test - If then, converse, inverse and contrapositive
1st Test - If then, converse, inverse and contrapositive1st Test - If then, converse, inverse and contrapositive
1st Test - If then, converse, inverse and contrapositiveBrandeis High School
 
Excel IF function
Excel IF functionExcel IF function
Excel IF functionHtay Aung
 
Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversionkanyuma jitjumnong
 
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates. Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates. Satya P. Joshi
 

En vedette (20)

Conditional Statements | If-then Statements
Conditional Statements | If-then StatementsConditional Statements | If-then Statements
Conditional Statements | If-then Statements
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statements
 
Conditional statement
Conditional statementConditional statement
Conditional statement
 
C if else
C if elseC if else
C if else
 
CONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGECONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGE
 
Octal and Hexadecimal Numbering Systems
Octal and Hexadecimal Numbering SystemsOctal and Hexadecimal Numbering Systems
Octal and Hexadecimal Numbering Systems
 
Binary octal
Binary octalBinary octal
Binary octal
 
1.3.2 Conditional Statements
1.3.2 Conditional Statements1.3.2 Conditional Statements
1.3.2 Conditional Statements
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statements
 
Using the IF Function in Excel
Using the IF Function in ExcelUsing the IF Function in Excel
Using the IF Function in Excel
 
Conditional statements
Conditional statementsConditional statements
Conditional statements
 
11 octal number system
11   octal number system11   octal number system
11 octal number system
 
1st Test - If then, converse, inverse and contrapositive
1st Test - If then, converse, inverse and contrapositive1st Test - If then, converse, inverse and contrapositive
1st Test - If then, converse, inverse and contrapositive
 
Excel IF function
Excel IF functionExcel IF function
Excel IF function
 
Number system conversion
Number system conversionNumber system conversion
Number system conversion
 
Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversion
 
Number System
Number SystemNumber System
Number System
 
Loops in C
Loops in CLoops in C
Loops in C
 
Number system
Number systemNumber system
Number system
 
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates. Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
Logic gates - AND, OR, NOT, NOR, NAND, XOR, XNOR Gates.
 

Similaire à Programming Basics if then else, switch, operators

Chapter 4 flow control structures and arrays
Chapter 4 flow control structures and arraysChapter 4 flow control structures and arrays
Chapter 4 flow control structures and arrayssshhzap
 
Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)heoff
 
05. Conditional Statements
05. Conditional Statements05. Conditional Statements
05. Conditional StatementsIntro C# Book
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statementsSaad Sheikh
 
Java tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo CahersiveenJava tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo CahersiveenGraham Royce
 
Chapter 03 conditional statements
Chapter 03   conditional statementsChapter 03   conditional statements
Chapter 03 conditional statementsDhani Ahmad
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.Tarunsingh198
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinarurumedina
 
Java Tutorial | My Heart
Java Tutorial | My HeartJava Tutorial | My Heart
Java Tutorial | My HeartBui Kiet
 

Similaire à Programming Basics if then else, switch, operators (20)

conditional_statement.pdf
conditional_statement.pdfconditional_statement.pdf
conditional_statement.pdf
 
Chapter 4 flow control structures and arrays
Chapter 4 flow control structures and arraysChapter 4 flow control structures and arrays
Chapter 4 flow control structures and arrays
 
Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)Final project powerpoint template (fndprg) (1)
Final project powerpoint template (fndprg) (1)
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
05. Conditional Statements
05. Conditional Statements05. Conditional Statements
05. Conditional Statements
 
Chapter 00 revision
Chapter 00 revisionChapter 00 revision
Chapter 00 revision
 
Control Statement programming
Control Statement programmingControl Statement programming
Control Statement programming
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
 
Java Tutorial
Java TutorialJava Tutorial
Java Tutorial
 
Java tut1
Java tut1Java tut1
Java tut1
 
Java tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo CahersiveenJava tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo Cahersiveen
 
Java tut1
Java tut1Java tut1
Java tut1
 
Javatut1
Javatut1 Javatut1
Javatut1
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
Java tutorial PPT
Java tutorial  PPTJava tutorial  PPT
Java tutorial PPT
 
Chapter 03 conditional statements
Chapter 03   conditional statementsChapter 03   conditional statements
Chapter 03 conditional statements
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medina
 
02 - Prepcode
02 - Prepcode02 - Prepcode
02 - Prepcode
 
Java Tutorial | My Heart
Java Tutorial | My HeartJava Tutorial | My Heart
Java Tutorial | My Heart
 

Plus de Trivuz ত্রিভুজ (6)

Web design basics 1
Web design basics 1Web design basics 1
Web design basics 1
 
Web design intro
Web design introWeb design intro
Web design intro
 
Database - Design & Implementation - 1
Database - Design & Implementation - 1Database - Design & Implementation - 1
Database - Design & Implementation - 1
 
Programming Basics - array, loops, funcitons
Programming Basics - array, loops, funcitonsProgramming Basics - array, loops, funcitons
Programming Basics - array, loops, funcitons
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Running @ maximum HP without Tearing Apart
Running @ maximum HP without Tearing ApartRunning @ maximum HP without Tearing Apart
Running @ maximum HP without Tearing Apart
 

Dernier

JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 

Dernier (20)

JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 

Programming Basics if then else, switch, operators

  • 1. TRIVUz Academy PF02 Class Id: Programming Fundamentals MS Alam TRIVUz Founder, TRIVUz Network TRIVUz Academy
  • 2. TRIVUz Academy Recap PF01 TRIVUz Academy
  • 3. We learn before We Define Computer & Program Define Computer Programming Programming Process Programming Language Inputs & Outputs Define Logical Processing Variables Data Types Programming Fundamentals TRIVUz Academy www.trivuzacademy.com
  • 4. We will learn today Conditional Statement If… then … else Switch statement Operators Programming Fundamentals TRIVUz Academy www.trivuzacademy.com
  • 5. Conditional Statement • Conditional statements are the set of command used to perform different actions base on different conditions • In PHP we have the following conditional statements: • if • if else • else if • switch TRIVUz Academy
  • 6. If statement execute some code only if statement is true TRIVUz Academy
  • 8. If… if TRIVUz Academy
  • 9. If… if (conditional) TRIVUz Academy
  • 10. If… if (conditional) { TRIVUz Academy
  • 11. If… if (conditional) { // statement to be executed TRIVUz Academy
  • 12. If… if (conditional) { // statement to be executed } TRIVUz Academy
  • 13. If… Example: if ($math < 33) { $result = “Failed!”; } TRIVUz Academy
  • 14. If…else statement execute some code if statement is true and some other code if statement is false TRIVUz Academy
  • 15. If…else… if (conditional) { // statement if true } TRIVUz Academy
  • 16. If…else… if (conditional) { // statement if true } else TRIVUz Academy
  • 17. If…else… if (conditional) { // statement if true } else { // statement if false TRIVUz Academy
  • 18. If…else… if (conditional) { // statement if true } else { // statement if false } TRIVUz Academy
  • 19. If…else… Example: if ($math < 33) { $result = “Failed!”; } else { $result = “Passed!”; } TRIVUz Academy
  • 20. If…else if…else statement execute some code if statement is true And some other code if statement is false TRIVUz Academy
  • 21. If…else if…else if (conditional) { // statement if true } else if (conditional){ // statement if false and else if true } else { // statement if all false } TRIVUz Academy
  • 22. If…else if…else if (conditional) { // statement if true } else if (conditional){ // whichever matches first } else if (conditional){ // whichever matches first } else if (conditional){ // whichever matches first } else if (conditional){ // whichever matches first } else { // statement if all false } TRIVUz Academy
  • 23. If…else if…else Example: if ($avg > 100) { $grade = "Invalid"; } else if ($avg > 90 and $avg < 100 ) { $grade = "A+"; } else if($avg > 80 and $avg < 90) { $grade = "A"; } else { $grade = "F"; } TRIVUz Academy
  • 24. switch statement Select one of many block of code to execute TRIVUz Academy
  • 26. switch switch (value) TRIVUz Academy
  • 27. switch switch (value) { TRIVUz Academy
  • 28. switch switch (value) { case 1: // some code to execute TRIVUz Academy
  • 29. switch switch (value) { case 1: // some code to execute break; TRIVUz Academy
  • 30. switch switch (value) { case 1: // some code to execute break; case 2: // some code to execute break; TRIVUz Academy
  • 31. switch switch (value) { case 1: // some code to execute break; case 2: // some code to execute break; default: // nothing matches, do it TRIVUz Academy
  • 32. switch switch (value) { case 1: // some code to execute break; case 2: // some code to execute break; default:  similar to else in if..else // nothing matches, do it TRIVUz Academy
  • 33. switch switch (value) { case 1: // some code to execute break; case 2: // some code to execute break; default: // nothing matches, do it } TRIVUz Academy
  • 34. switch switch (n) { case label1: code to be executed if n=label1; break; case label2: code to be executed if n=label2; break; default: code to be executed if n is different from both label1 and label2; } TRIVUz Academy
  • 35. switch <html> <body> <?php switch ($x) { case 1: echo "Number 1"; break; case 2: echo "Number 2"; break; case 3: echo "Number 3"; break; default: echo "No number between 1 and 3"; } ?> </body> TRIVUz Academy </html>
  • 36. PHP Operators Operators are used to operate on values TRIVUz Academy
  • 40. Operators Logical Operators TRIVUz Academy
  • 41. Thank You MS Alam TRIVUz Founder, TRIVUz Academy trivuz@gmail.com

Notes de l'éditeur

  1. ----- Meeting Notes (12/28/11 19:20) -----