0

Can you please explain else statement

Baby gaara (avatar) and I don't understand else statement please explain(what a else statement is)

20th Apr 2020, 11:38 AM
Ritu Miah
Ritu Miah - avatar
51 Respuestas
+ 9
The if/else statement executes a block of code if a specified condition is true. If the condition is false, another block of code can be executed, which is the else statement. For Example: if (10 > 20) { return "true" } else { return "false" } since 10 is not greater than 20, the code output will return "false". Hope that helped you.
21st Apr 2020, 10:37 PM
0xBADC0DE
0xBADC0DE - avatar
+ 6
IF (my answer helped you)✅ run this {recognize my answer as the best for your understanding by choosing It} ELSE ❎{recognize my effort in explain to you by upvoting It} ⚫️IF...STATEMENT fluxogram: ✅True, something happen, as turn left; ❌False, nothing happen. ⚫️IF...ELSE STATEMENT fluxogram: ✅True, something happen, like turn left; ❎False, the opposite thing happen, like turn right. Code controling the flow of actions: IF...ELSE STATEMENT case: (Test is made) ⬇️ {Run IF is true}⬅️➡️ {ELSE run IF is false} God bless us with love, peace and health! Hugs 🤜🏼🤛🏼.
21st Apr 2020, 5:21 AM
‎‏‪‏‪‏‪Vinícius dos Reis Lobo Silva‬‏‬‏‬‏‎
‎‏‪‏‪‏‪Vinícius dos Reis Lobo Silva‬‏‬‏‬‏‎ - avatar
+ 5
Hello there , well imagine with me for an instinct you went to do your day to day grocery shopping and you wanted to buy a specific product but there was none left of it! So you quickly thought and decided to buy an alternative one you found ! The same concept with code, the else statement is your a.k.a "alternative" , So when your program is executed it checks the condition of your if statement, If it was verified it runs the whole code nested within it! (if the product you wanted was available, you buy it) Else : the "alternative" code runs (there was no more left of the product, so you bought the alternative one! ) I hope it makes sense to you!
20th Apr 2020, 9:54 PM
Dreamy
Dreamy - avatar
+ 5
Ritu Miah IF you are a Gaara.baby admirer(true), this will execute> {interpreting the Gaara.baby very wellly done hahahahahah(obs: he also wants to play with his parents and had socialization problems, and loneless)} IF THE PREVIOUS TRUE STATEMENT IS FALSE and you do not admire baby Gaara, run this code > {Forgive me for misunderstand your intentions and feelings} The second part, the IF THE PREVIOUS TRUE STATEMENT IS FALSE, can be simplified for ELSE, wich means an opposite situation from what It is expected. The IF...STATEMENTS and IF...ELSE STATEMENTS are used for control the code flow, It produces a bifurcation in the street of code. If something is true, the left street is taken, in the IF STATEMENT case. If something is true, the left street is taken, or If something is false, the right street is taken, in the IF...ELSE STATEMENT case. The IF...STATEMENTS set a verification and IF is true something happen, and IF the statement is false, nothing happen. The IF...ELSE STATEMENTS complement that notion...
21st Apr 2020, 4:56 AM
‎‏‪‏‪‏‪Vinícius dos Reis Lobo Silva‬‏‬‏‬‏‎
‎‏‪‏‪‏‪Vinícius dos Reis Lobo Silva‬‏‬‏‬‏‎ - avatar
+ 4
One explanation for baby Gaara and one explanation for Ritu Miah , all fine, all good hahaha.
21st Apr 2020, 5:33 AM
‎‏‪‏‪‏‪Vinícius dos Reis Lobo Silva‬‏‬‏‬‏‎
‎‏‪‏‪‏‪Vinícius dos Reis Lobo Silva‬‏‬‏‬‏‎ - avatar
+ 3
If you wanna talk follow each other than message each other because I didn't make this question so people could chat to one another
20th Apr 2020, 12:28 PM
Ritu Miah
Ritu Miah - avatar
+ 3
I think u r not trying to understand if u try then all the comment on your question are enough.. 😡😡😡
21st Apr 2020, 3:32 PM
Wade
Wade - avatar
+ 3
In programming languages, an else statement is an alternative statement that is executed if the result of a previous test condition evaluates to false.
22nd Apr 2020, 7:44 AM
Anonymous
Anonymous - avatar
+ 2
So I spend time doing python
20th Apr 2020, 12:09 PM
Ritu Miah
Ritu Miah - avatar
+ 2
Also what please don't say something bad
20th Apr 2020, 12:29 PM
Ritu Miah
Ritu Miah - avatar
+ 2
Here when the condition in if was correct then it will display the statement otherwise else condition statement will display
20th Apr 2020, 4:49 PM
Deepa Suriya
Deepa Suriya - avatar
+ 2
If statement works in true cinditions and else works in false conditions.
20th Apr 2020, 6:59 PM
Shafiqul Islam
Shafiqul Islam - avatar
+ 2
An else statement cannot exist alone alright!.. imagine if you have to write a code block and .... You have an aim that this particular code block should be executed only when a condition is satisfied.. However , you also have in mind what to do when the condition fails: there comes the else condition See it will be like... If ( condition) { Execute this block when condition true } else { Execute this block when condition is false }
21st Apr 2020, 8:44 PM
Sumegh G. Tembhurne
Sumegh G. Tembhurne - avatar
+ 2
Else statement runs only if the 'if' statement runs false. Else statements don't need any condition, it does the opposite of 'if' statement. Also, you can give an elif statement which needs a condition, which runs if the 'if' statement runs false (a kinda else statement with conditions!).
22nd Apr 2020, 6:22 AM
TAVISH
TAVISH - avatar
+ 1
~ swim ~ No but just answering thinking completely beginner.. Because why he/she only asking else part only.. You can see in the description of adding childish info.. So. Edit: In between, when I started answer, I don't see your reply,. After I posted, after refreshing I see you already answered.. It happening most of times for same.. May be my typing skills very slow..
20th Apr 2020, 11:59 AM
Jayakrishna 🇮🇳
+ 1
Hello
20th Apr 2020, 12:32 PM
Ritu Miah
Ritu Miah - avatar
+ 1
Are you gone
20th Apr 2020, 12:32 PM
Ritu Miah
Ritu Miah - avatar
+ 1
????????????
20th Apr 2020, 12:37 PM
Ritu Miah
Ritu Miah - avatar
+ 1
I am probably not supposed to understand this
20th Apr 2020, 12:39 PM
Ritu Miah
Ritu Miah - avatar