Why we use colon(:) after if and else not use other symbol. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why we use colon(:) after if and else not use other symbol.

Phython

18th Jul 2020, 5:28 AM
Apoorv Bansal
3 Answers
+ 1
Apoorv Bansal Just try to use and see what happens. Rule is rule you can't change. You have to follow.
18th Jul 2020, 5:40 AM
A͢J
A͢J - avatar
0
That's the syntax. You don't have a choice.
18th Jul 2020, 5:33 AM
Ore
Ore - avatar
0
It used to declare the start of indented block.. colon makes it easier for editors with syntax highlighting (:) they can look for colons to decide when indentation needs to be increased also to make it easier to read.
18th Jul 2020, 5:40 AM
Sarfira
Sarfira - avatar