Game Development Course Class# 14: Switch Statement | Difference between If and Else-If

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ธ.ค. 2024

ความคิดเห็น • 61

  • @FarhanAqeel
    @FarhanAqeel  4 ปีที่แล้ว +6

    Practice nahi karogay to sir k uper se nikal jaeyga :) Share this with others..
    Full series: th-cam.com/play/PLBh8phtAyHPUY9fqgs1w6aHJALJ3_fMSc.html
    Group: facebook.com/groups/FreelancingHelpOfficial
    Insta: "farhan.aqeel"

  • @hassaanraheem5644
    @hassaanraheem5644 4 ปีที่แล้ว +4

    Difference Between Multiple If -Statements & If/elseif../else Statements :
    ⭐Multiple if statements :
    Is case Mai agr sari conditions check hoti hai agr koi condition pehly true bi ho tu ye baqi conditions ko bi check krega is case Mai program ka execution time brjayega.
    ⭐If/elseif.../else statements :
    is case Mai agr koi condition true hojati hai tu ye baqi tamam neechy wali conditions ko ignore krdega.
    (It is same like switch statement) because usmai bi agr 1condition true hoti hai tu baqi tamam neeche wali conditions ko ignore krke switch ke code block se bahir chlajayega.

  • @jahangirakbar4524
    @jahangirakbar4524 4 ปีที่แล้ว +1

    Yar Zabardast hamaray Pakistani Hamesha se acha Samjhatay hen 👍

  • @muhammadadil-or3kb
    @muhammadadil-or3kb 3 ปีที่แล้ว

    great Farhan Bhai

  • @Gamering_op
    @Gamering_op 4 หลายเดือนก่อน

    sai hai sai hai sai hai 😂😂😂😂😂😂

  • @vloglife4813
    @vloglife4813 4 ปีที่แล้ว +21

    Who came here after memes 🤣🤣

  • @kamran5482
    @kamran5482 4 ปีที่แล้ว +3

    The difference is that if the first if statement is true all of the other else ifs statements unable to be executed while in the case of individual ifs all of the ifs will be executed if they are true.

  • @brokenlove2993
    @brokenlove2993 2 ปีที่แล้ว

    Sir,
    mera ide errors pr red line nhi de rha/ lightbulb does not popup.
    issues honey ke bawajood neche "no issues found" likha aata hy
    help me plz

  • @gy9192
    @gy9192 4 ปีที่แล้ว

    Great sir !! That's what I wanted.

  • @mahindersingh3995
    @mahindersingh3995 3 ปีที่แล้ว +5

    //In case of if;
    //Use the if statement to specify a block of C# code to be executed if a condition is True.
    //IN case else if;
    //Use the else if statement to specify a new condition if the first condition is False.

  • @katmovie6976
    @katmovie6976 4 ปีที่แล้ว

    Salam bro,
    Ma na ap say poochna tha kay upwork par specialize profile ka kya chkr hota ha. mtlb ma portfolio add kar raha tha to uss na pehla specialize profile create karwai. ab do profile haan aur samaj nai aa rai kis ma kya likho. Please guide.

  • @shami621
    @shami621 4 ปีที่แล้ว +4

    If statement agr multiple time use krte hen tu sare if condition execution k waqt check hoti hen or agr hum if else use krte hen tu compiler ko jese hi true condition milti baqi ki sari conditions skip ho jati hen jis se execution time kam ho jata he

  • @ktv7500
    @ktv7500 2 ปีที่แล้ว

    Mjhe smjh ni i😓 , jb switch statements use kren ge to "if" statements bhi likhain ge pehle?
    K directly variable k bad switch statements likhna shuru krdenge?

  • @Mehendi.by.laibaa
    @Mehendi.by.laibaa 2 ปีที่แล้ว +5

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class SwitchStatement : MonoBehaviour
    {
    //Switch statements are better if we are using multiple
    //else if
    // Start is called before the first frame update
    public int MyAge = 15;
    void Start()
    {
    switch(MyAge){
    case (15):
    Debug.Log("you are a teenager");
    break;
    case (20):
    Debug.Log("you are an adult");
    break;
    case (25):
    Debug.Log("you are a mature");
    break;
    case (30):
    Debug.Log("you are a now able to be married in pakistan");
    break;
    default:
    Debug.Log("Bhai tu kunwara marega");
    break;
    }
    }
    }

  • @mhasultanmohammed4552
    @mhasultanmohammed4552 3 ปีที่แล้ว

    Farhan Bhai default keyword ma break statement zaroori nhi hota!!

  • @iftihameedirfan
    @iftihameedirfan 3 ปีที่แล้ว +1

    For screen shoot (win + ALt + PrtScr)

  • @zynxajeaesthetics6067
    @zynxajeaesthetics6067 4 ปีที่แล้ว

    You are my Hero Sir

  • @rapbarz2813
    @rapbarz2813 4 ปีที่แล้ว +8

    Sir mobile sa earning kaise kare?
    Le sir: mobile bech ke
    Lmao🤣🤣

  • @syedmubashirali4293
    @syedmubashirali4293 3 ปีที่แล้ว

    Sir if or else if me ye difference hai ke jab ham srif if use karte hain kisi condition ke sath tu vo har ius message ko chala ta hai jo upper deye gae variable ce match kr jata
    hai cha vo ak variable ho ya ak agar ak ce match kr jae tu ak chala ta hai or agar 2 ya 3 ce match kr jae tu teeno chala de ta hai for example.
    Agar me condition don variable main ke pehle(1) dahi ke dukan or tesre (3) dahi ke dukan open hai yane me 2 variables ko true kar don tu if ke keyword Vala code in dono ko console window me show kare ga.
    Jabke else if ic ka ulta hai ic me agar main same misal jo mene upper de ius he ko istemal karon tu
    Vo srif ak true condition ko chale ga jo ius ko sab ce pehle mil jae ge or ius ce agay nahi jae ga ..

  • @syedahmadshah2298
    @syedahmadshah2298 4 ปีที่แล้ว +1

    A o a
    Brother ap sy ak bt pkchni thi agr my game developer bana chaho to kitny din my ban skta hn mujhy abi is bary my basic bhi ni pta kia my ya course kr k bn skta hn ya koi coding bhi sekhni ho gi

    • @FarhanAqeel
      @FarhanAqeel  4 ปีที่แล้ว

      WS. Welcome :)
      in dono cheezon k liay pehle FAQs dekhen:
      th-cam.com/video/iLwvFBLbols/w-d-xo.html
      Then us k bad ye walay steps: th-cam.com/video/oriezhSIIY4/w-d-xo.html
      ap k sb questions clear hojaengay :)

  • @animal14344
    @animal14344 2 ปีที่แล้ว

    sir variable me private or public ka musla araha he

  • @gamingprincipal3509
    @gamingprincipal3509 2 ปีที่แล้ว

    sir debug nhi ho rha he

  • @mhasultanmohammed4552
    @mhasultanmohammed4552 3 ปีที่แล้ว

    If "else" statement is not used before if after the main if statement then it will be considered a new conditional structure rather than the part of the same structure and all the statements following if statements will be executed (if true) .
    But if "else if" statement is used then it will be considered the same conditional structure and if the condition following if statement is false it will be skipped and the compiler will move ahead to the next else if condition and so on.

  • @rtxgaming91
    @rtxgaming91 ปีที่แล้ว

    They are more or less the same, but there is one subtle difference: in the first case, only one of the two statements can be executed while in the second case it is possible for both of them to be executed.

  • @prostitching2421
    @prostitching2421 4 ปีที่แล้ว

    sir vidoe bhot kam han game development ki or bhi record kro jitnyeee zada video hun itna zayada sekhny ko mily ga apko utna hi good respose mily ga stay blessed.

  • @playtime3d
    @playtime3d ปีที่แล้ว +2

    #14 Sir Am I Right?
    using System.Collections;
    using System.Collections.Generic;
    using UnityEditor.Experimental.GraphView;
    using UnityEngine;
    public class variable : MonoBehaviour
    {
    private int loaddeAmmo = 0;
    private int ammoInBackpack = 0;
    void Start()
    {
    if (loaddeAmmo > 0)
    {
    Debug.Log("Bullets Firing");
    }
    else if ((loaddeAmmo == 0) && (ammoInBackpack>0))
    {
    Debug.Log("Gun Is Reloading");
    }
    else
    {
    Debug.Log("Ammo Is Out");
    }
    }
    // Update is called once per frame
    void Update()
    {

    }
    }

  • @hackinglifealways3950
    @hackinglifealways3950 3 ปีที่แล้ว +2

    in "if statement" the compiler check all the conditions but at "if else" compiler check when the condition is true then it does not compile any further condition.

  • @hamxakhan037
    @hamxakhan037 4 ปีที่แล้ว

    In multiples if statements all the statements will be checked even after it identifies true statement it will take some time.
    On the other hand in else if only true statement will be checked and rest are bypassed.

  • @mayankdhiman5355
    @mayankdhiman5355 3 ปีที่แล้ว

    multiple if statement are independent of other as if -else if are not

  • @muhammadnofilibrahim5266
    @muhammadnofilibrahim5266 3 ปีที่แล้ว

    In more than 1 if conditions the compiler executes all the conditions doesn't matter even the first condition is true, while on other hand in else if, if the first condition is true all the other else if conditions will not be compiled by the compiler because the compiler knows the first condition is true and doesn't need to ckeck other conditions.

  • @Osman-nl5cn
    @Osman-nl5cn ปีที่แล้ว

    thank a lot sir

  • @zaidpics8772
    @zaidpics8772 3 ปีที่แล้ว

    Are waah, chota bheem to world famous nikla...

  • @huzaifamk
    @huzaifamk 3 ปีที่แล้ว

    A switch statement is usually more efficient than a set of nested ifs. ...
    if-else better for boolean values: If-else conditional branches are great for
    variable conditions that result into a boolean, whereas switch statements are
    great for fixed data values.Default is used instead of else.
    -Break is used to terminate the code .

  • @good114
    @good114 ปีที่แล้ว

  • @DefaultCubie
    @DefaultCubie 3 ปีที่แล้ว

    agar ham else if use karenge to ek petrol pump se bharwa ke ajaega petrol lekin agar if use kara to har petrol pump se petrol bharwa ka ana padega🤣🤣🤣

  • @umairgodzilla415
    @umairgodzilla415 ปีที่แล้ว

    --------If means bhai aghar petrol pump khla howa ha to petrol fill kr wa lena.
    --------else if wrna dosra per jana
    private bool firstPetrolPumpIsOpen = false;
    private bool secondPetrolPumpIsOpen = false;
    private bool thirdPetrolPumpIsOpen = false;
    void Start()
    {
    if (firstPetrolPumpIsOpen == true)
    {
    Debug.Log("First pump is open and fill up");
    }
    else if (secondPetrolPumpIsOpen == true)
    {
    Debug.Log("second pump is open and fill up");
    }
    else if (thirdPetrolPumpIsOpen == true)
    {
    Debug.Log("third pump is open and fill up");
    }
    else
    {
    Debug.Log("Come back");
    }
    }
    }

  • @rizwanminallahofficial19
    @rizwanminallahofficial19 3 ปีที่แล้ว

    Dear friend i am an ex student i left edu. I was a bio student have passed fsc 2nd year my name is Rizwan khan . What do u prefer next specially in game development and tell me i from first video up this 14th video i have watched please just guide me on debug . Log and also tell me is code clossing curly bracket equal to BREAK a d also telle why semicolons ; in the end of the code reply must

    • @FarhanAqeel
      @FarhanAqeel  3 ปีที่แล้ว

      Try following the series from class 1 and make notes. Post your questions in the facebook group

  • @alifarooq9023
    @alifarooq9023 2 ปีที่แล้ว

    you are adding too much in this problem i have figured out the best way to implement this :
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class Test : MonoBehaviour
    {
    public string name;
    // Start is called before the first frame update
    void Start()
    {
    Debug.Log("Welcome" + name);
    }
    }

  • @subhanshaikh8581
    @subhanshaikh8581 4 ปีที่แล้ว +2

    Koi instagram pe ghanta page ki meme dekh k yahan aya he ya me akela hu?

    • @trendingvideos8552
      @trendingvideos8552 4 ปีที่แล้ว

      Konsi meme?

    • @subhanshaikh8581
      @subhanshaikh8581 4 ปีที่แล้ว +1

      @@trendingvideos8552 instgram pe page he 1 ghanta nam he 8 mullions follower he uske
      Usme kisi ne inse pucha mobile se pesa kese kamaye to inhone bola mobile bech k

    • @eFootballl07
      @eFootballl07 4 ปีที่แล้ว

      mai😁😁😁phone sa earning kaisa kiya jai sikna aya hu😂

    • @Sk_____9.
      @Sk_____9. 4 ปีที่แล้ว

      Me 😁😁😁

    • @UpdateWithAstro
      @UpdateWithAstro 4 ปีที่แล้ว

      Mai

  • @umairgaming7474
    @umairgaming7474 ปีที่แล้ว

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class ifStatment : MonoBehaviour
    {

    private string IQ = "100";
    // Start is called before the first frame update
    void Start()
    {
    // Activity Is Which Friend/Friends Came TO Your House

    switch (IQ)
    {
    case "80":
    Debug.Log(" Your IQ Level Is Normal ");
    break;
    case "100":
    Debug.Log(" Your IQ Level Is Good ");
    break;
    case "150":
    Debug.Log(" Your IQ Level Is High ");
    break;
    case "200":
    Debug.Log(" Your IQ Level Is SuperHuman ");
    break;
    default:
    Debug.Log(" YOu Don't Have IQ Level");
    break;
    }
    }}

  • @pscoder7960
    @pscoder7960 ปีที่แล้ว

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class SwitchStatement : MonoBehaviour
    {
    //Switch statements are better if we are using multiple
    //else if
    // Start is called before the first frame update
    public int MyAge = 15;
    void Start()
    {
    switch(MyAge){
    case (15):
    Debug.Log("you are a teenager");
    break;
    case (20):
    Debug.Log("you are an adult");
    break;
    case (25):
    Debug.Log("you are a mature");
    break;
    case (30):
    Debug.Log("you are a now able to be married in pakistan");
    break;
    default:
    Debug.Log("Bhai tu kunwara marega");
    break;
    }
    }
    }