how do i use the elif function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

how do i use the elif function

like after doing a conditional statement with if and i wan to follow up with another condition

23rd Oct 2021, 5:03 PM
Gab Jord
9 Answers
+ 2
It is explained in "Control Flow" -> "else Statement" Continue with the tutorial if you haven't got to that chapter ...
23rd Oct 2021, 5:15 PM
+ 2
Elif in conditional statement is same as else if statement ...we use them if we want to test the condition more than ones is used in python to shorten the else if to elif....that is it for me
24th Oct 2021, 8:39 PM
Ong'ondi Eugene
Ong'ondi Eugene - avatar
+ 1
Hello, please try to figure this out yourself, this is by far the easiest and most common programming concept in existence.
23rd Oct 2021, 5:25 PM
Jibraeel Abdelwahhab
Jibraeel Abdelwahhab - avatar
+ 1
Please always tag the language you're asking about.
23rd Oct 2021, 6:05 PM
Simon Sauter
Simon Sauter - avatar
+ 1
if elif else
23rd Oct 2021, 7:21 PM
Shadoff - avatar
+ 1
elif is used when u have more than two statment, lets imagine u have three paths ways and u have to choose between those three, and each path way has its own results ex. number = 1 if number == 1: print(“one”) elif number == 2: print(“two”) else: print(“rest of the number”) as u could notice there where 3 different path ways and the computer will choose according to the staments. if number is equal to 1 it will return one and if number is 2 it will return two and if number is any other number beside this two it will reuturn rest of the numbers… I wish u understood😅
25th Oct 2021, 10:52 AM
Miller Monteiro
Miller Monteiro - avatar
pls help
23rd Oct 2021, 5:03 PM
Gab Jord
Elif goes after if statement and before the else. It's used if you have another condition that you need to check (if it's not this, then check that, then that)
24th Oct 2021, 9:21 PM
flower power
Is it for python?
25th Oct 2021, 10:45 AM
Jolen Mascarenhas