MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/CodingHelp/comments/rmwdib/whats_wrong/hpsyb3m/?context=3
r/CodingHelp • u/CAGRI-TR • Dec 23 '21
90 comments sorted by
View all comments
-2
Just use if, no need to use else if
1 u/IntroductionBright72 Dec 23 '21 But if there's multiple conditions we kinda need to use the else if🤔 1 u/Similar-Concert4100 Dec 24 '21 Else if looks to see if multiple conditions are true, here only one condition should be true. Each should be an if statement, no else if 1 u/vigbiorn Dec 24 '21 This is pretty much the direct opposite.A series of ifs will all be evaluated, in order, regardless of the value. An else-if series like this executes until the first true condition is found.You would use a series of ifs to find multiple conditions being true.
1
But if there's multiple conditions we kinda need to use the else if🤔
1 u/Similar-Concert4100 Dec 24 '21 Else if looks to see if multiple conditions are true, here only one condition should be true. Each should be an if statement, no else if 1 u/vigbiorn Dec 24 '21 This is pretty much the direct opposite.A series of ifs will all be evaluated, in order, regardless of the value. An else-if series like this executes until the first true condition is found.You would use a series of ifs to find multiple conditions being true.
Else if looks to see if multiple conditions are true, here only one condition should be true. Each should be an if statement, no else if
1 u/vigbiorn Dec 24 '21 This is pretty much the direct opposite.A series of ifs will all be evaluated, in order, regardless of the value. An else-if series like this executes until the first true condition is found.You would use a series of ifs to find multiple conditions being true.
This is pretty much the direct opposite.
A series of ifs will all be evaluated, in order, regardless of the value. An else-if series like this executes until the first true condition is found.
You would use a series of ifs to find multiple conditions being true.
-2
u/Similar-Concert4100 Dec 23 '21
Just use if, no need to use else if