Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You're right, you could do this in Python because it uses indentation for block delimiting. That means this is unambiguous:

    if c1 then:
      s1
    else if c2:
      s2
    s3
Without significant indentation, it's not possible to tell if "s3" is indented to be part of the the second if's then branch.

In other words, "else if" and "else INDENT if" are unambiguously different in Python.

That's not true in other languages that use "elif"/"elsif"/"elseif" where only newlines are significant and not indentation.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: