假设我想设置一堆等于 null 的变量(并且不想使用数组/循环结构),或者我只想跨多行编写一个大型布尔表达式。在这种情况下,未闭合的括号会阻止分号插入吗?例如
some_variable = another_variable = yet_another_variable = (
oh_look_a_parenthesis_above_me = hey_heres_another_variable) = (
and_for_some_reason_another = last_one) = null;
或者
if(test_for_some_complex_expr && another_test || (
but_maybe_this_one && or_this_one)) {
// ...
}
这与使用&&
or ||
or=
对换行符分组表达式有何比较?即,这也总是有效吗?
some_variable = another_variable =
a_variable_after_a_line_break = and_one_more;
while(test_for_an_expr && another_test ||
(an_expr_here && and_an_expr_here)) {
// ...
}
我正在寻找所有浏览器(包括 IE6+)中最标准的方式。