0

C# - имеется ли строгость в том, какие отступы я сделаю под case? C# - is there strictness on how I indent the code under case?

В структуре "switch - case - действие" действие должно записываться с отступом, как в большинстве условных операций Python, или в этом нет разницы? In a switch - case - action structure, the action should be indented like most Python conditionals, or there is no difference?

1st Feb 2021, 8:36 AM
FogyX
FogyX - avatar
3 Respuestas
+ 5
Use of `break` in each case labels is more important than indentation. C# marks blocks of code by curly braces, so indentation isn't as crucial as Python which marks blocks of code by indents. Therefore indentation in C# is more about code readability than it is for block identification. Just a personal opinion ...
1st Feb 2021, 8:49 AM
Ipang
+ 3
As far as I know, no, indentation does not matter in C# (also the most of other programming languages). Насколько я знаю, нет, отступы не имеют значения в C# (а также в большинстве других языков программирования).
1st Feb 2021, 8:50 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 2
Thx everyone
1st Feb 2021, 10:25 AM
FogyX
FogyX - avatar