本文介绍了代码样式:如何格式if if,ifelse,else语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过if,ifelse,else语句(花括号{})的许多不同格式。我想知道如果将这些花括号放在特定位置,它会影响代码。如果他们不这样做,你能告诉我哪一个看起来更有组织吗?提前致谢!





例如:



I have seen many different formats for if, ifelse, else statements(The curly braces {}). I would like to know if by placing these curly braces in a specific position, it would affect the code. If they do not, could you tell me which one looks more "organized?" Thanks in advance!


examples:

if(something) {
    do this;
}
//---------
if(something)
{
do this;
}
//---------
if(something)
{do this;}

推荐答案


这篇关于代码样式:如何格式if if,ifelse,else语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 10:35