问题描述
为什么每个人都喜欢下面的花括号语法
function(){
implementation;
}
我发现以下更好的阅读(C风格)
功能()
{
实施;
}
亲切问候,
巴特
Why is it that everybody likes the follwowing curly braces syntax
function() {
implementations;
}
I find the following much better to read (C style)
function()
{
implementations;
}
kind regards,
Bart
推荐答案
对于样式,我遵循英语的最终确认参考 - /
样式元素/。
它表示在并行概念上使用并行构造。
不要说,大红狮躺着羔羊,小而毛茸茸的。
说,大红狮躺着小毛茸茸的羊羔。
形容词与它们的名词的关系平行。
因此,在编程中,将花括号放在彼此平行的位置。
-
Phlip
For style, I follow the ultimate acknowledge reference for English - /The
Elements of Style/.
It says to use parallel construction on parallel concepts.
Don''t say, "The big red lion lay down with the lamb, small and furry".
Say, "The big red lion lay down with the small furry lamb."
The adjectives parallel their relation to their noun.
So, in programming, put the curly braces where they parallel each other.
--
Phlip
我不认为每个人都喜欢前者。我认为至少有一半的人比较喜欢后者。
I don''t think everybody does like the former. I think at least half the
people prefer the latter.
是什么让你认为后者是C风格?是什么让你觉得它更容易阅读?
What makes you think the latter is C style? And what makes you think it''s
easier to read?
这篇关于匹配{}语法风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!