What's the purpose of using braces (i.e. {}) for a single-line if or loop?

前端 未结 23 1353
独厮守ぢ
独厮守ぢ 2020-11-28 00:33

I\'m reading some lecture notes of my C++ lecturer and he wrote the following:

  1. Use Indentation // OK
  2. Never rely on operator preced
23条回答
  •  [愿得一人]
    2020-11-28 01:34

    It makes your code more readable by clearly defining the scope of your loops and conditional blocks. It also saves you from accidental mistakes.

提交回复
热议问题