+ 1
Can someone explain elif with proper example ?Where it can be used ?
6 Réponses
+ 4
https://code.sololearn.com/cYaBuX9e2b1u/?ref=app
A simple example of else if statement in Java.Try it you will get the idea.
+ 4
Just try to read the code basic function is same for both.
+ 3
Elif is short for 'else if'. It means it is executed when the above 'if' condition is false, but the following condition is true.
Example:
age =int(input("What's your age?\n"))
if age < 13:
print("You're a child")
elif age < 60:
print("You're an adult")
elif age < 100:
print("You're old")
else:
print("You're still alive?")
In the example, you can see that the second statement runs only if the first is false (meaning age >= 13), and the third runs only if the secod ifs false, and so on.
Hope this helped :)
+ 1
I dont know java .
Can you explain ,in context of python.
+ 1
Hey,
thanks man .
0
No problem :)