嵌套的if语句没有括号 [英] Nested if-statements without brackets
本文介绍了嵌套的if语句没有括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给出以下代码:
if (c2-c1==0)
if ( c1 != c3 )
{...}
如何解释此代码?第一个if语句没有 {} 。上面的代码是否等于以下代码?:
How do I interpret this code? The first if-statement comes without {}. Is the code above equal to the following code?:
if (c2-c1==0){
if ( c1 != c3 )
{...}
}
推荐答案
是的。 if语句适用于它之后的下一个语句 - 在这种情况下恰好是另一个语句。
Yes. The if statement applies to the next statement after it - which happens to be another if in this case.
这篇关于嵌套的if语句没有括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文