...conditional...

hrithik_gorane_

Hrithik Gorane

Posted on October 6, 2024

...conditional...

whenever we heard/thought about conditional we can relate easily because it's part of our life. how, suppose you have two car one car fuel is petrol and second car fuel is diesel. now you're first car fuel is empty then you will drive second car correct because here first's car fuel is empty therefore you chosen second car.

if you're first car has fuel then you can not choose second you go with you're first car right. similarly in computer we used these kind of conditions with deal and handle the case and solve the problem easily.in computer these case we used if else term. if term we put condition and else part we simply showcase if condition not satisfied. here below if else condition syntax,

if(condition){

statement :

}else{

statement :

}

ex, if(mark > 33){

    statement : pass

    }else{

    statement : fail

    }
Enter fullscreen mode Exit fullscreen mode

above example we can easily understand that if student get marks above 33 then he pass or student is fail.

if you have multiple condition then you can use else if condition where it known as ladder condition.

here below syntax,

if(condition){

statement :

}else if(condition){

statement :

}else{

statement :

}

Enter fullscreen mode Exit fullscreen mode

here how we know about conditional. keep practice, remember we are in community where you can ask it and you get answer that ask for it.

💖 💪 🙅 🚩
hrithik_gorane_
Hrithik Gorane

Posted on October 6, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related