0
Someone please explain the if & else statement to me...I'm kinda struggling with that...
If else statement
3 Answers
+ 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
+ 3
in what programming language
+ 2
https://code.sololearn.com/cq0XKEcOgol4/?ref=app
this should explain.