Someone please explain the if & else statement to me...I'm kinda struggling with that... | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Someone please explain the if & else statement to me...I'm kinda struggling with that...

If else statement

28th Jun 2018, 5:08 PM
Innocent
Innocent - avatar
3 ответов
+ 6
In most programming languages, if...else block is used when you need to make a decision for which block of code should be executed next, depending on some condition(s) that are evaluated. The if...else block is used when you decided that there should only be two options to choose. If you use 'else if' it means you have multiple options (more than two), to each the condition(s) is evaluated for. C++ or Java: bool youAreYoung = true; if(youAreYoung) { // This block is executed // if youAreYoung is true } else { // This block is executed // if youAreYoung is false } Hth, cmiiw
29th Jun 2018, 8:41 AM
Ipang
+ 3
in what programming language
28th Jun 2018, 5:15 PM
LONGTIE👔
LONGTIE👔 - avatar
28th Jun 2018, 5:22 PM
LONGTIE👔
LONGTIE👔 - avatar