Why do Perl control statements require braces?

后端 未结 8 1177
挽巷
挽巷 2021-02-07 00:05

This may look like the recent question that asked why Perl doesn\'t allow one-liners to be \"unblocked,\" but I found the answers to that question unsatisfactory because they ei

8条回答
  •  迷失自我
    2021-02-07 00:25

    Just guessing here, but "unblocked" loops/ifs/etc. tend to be places where subtle bugs are introduced during code maintenance, since a sloppy maintainer might try to add another line "inside the loop" without realizing that it's not really inside.

    Of course, this is Perl we're talking about, so probably any argument that relies on maintainability is suspect... :)

提交回复
热议问题