When do you use code blocks?

后端 未结 4 1882
名媛妹妹
名媛妹妹 2020-12-21 03:08

When do you use code blocks in C/C++/C#, etc.? I know the theoretical reason behind them, but when do you use them in real programs?

EDIT: I have ju

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-21 03:25

    I do the same thing with switch blocks, even though it isn't required. In general, I use code blocks where they either make code more readable (whether that's through giving similar blocks of code a similar appearance or just getting the indenting) or they properly scope variables.

提交回复
热议问题