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
 
Javatut1
Javatut1 Javatut1
Javatut1
 
Java tut1
Java tut1Java tut1
Java tut1
 
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

ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

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) -----