Colon | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Colon

Y we need to use colon for if statement and can we use else if instead of elif statement

22nd May 2019, 7:24 AM
Vishal Pai
Vishal Pai - avatar
2 Answers
+ 7
In ""Python"" We need to use colon after if and Elif statements as it is in python Syntx : if (conditions): ## else : ## just like we use curly braces in java script if (conditions){ ## } else { ## } And sorry no u cant use else it instead of Elif as in Python else if is regarded as Elif ,just the short form.
22nd May 2019, 7:42 AM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 2
Thanks bro
22nd May 2019, 7:44 AM
Vishal Pai
Vishal Pai - avatar