Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dangling else in python

Tags:

python

Just want confirmation that this assertion is correct:

python cannot ever experience the dangling else problem

UPDATE fixed typo

like image 638
Frankie Ribery Avatar asked Dec 08 '25 23:12

Frankie Ribery


1 Answers

Python's blocks are indentation-based, not delimiter-based, therefore it is possible to unambiguously associate an else clause with its corresponding primary clause.

like image 149
Ignacio Vazquez-Abrams Avatar answered Dec 11 '25 11:12

Ignacio Vazquez-Abrams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!