Mandatory use of braces

前端 未结 21 2321
旧时难觅i
旧时难觅i 2021-02-12 23:26

As part of a code standards document I wrote awhile back, I enforce \"you must always use braces for loops and/or conditional code blocks, even (especially) if they\'re only one

21条回答
  •  情书的邮戳
    2021-02-13 00:04

    I have yet to have anyone come up with a good reason not to always use curly braces.

    The benefits far exceed any "it feels ugly" reason I've heard.

    Coding standard exist to make code easier to read and reduce errors.

    This is one standard that truly pays off.

提交回复
热议问题