修改if语句但是使用大括号问题。 [英] Modifying the if statement but problem with braces.

查看:209
本文介绍了修改if语句但是使用大括号问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家好。

我的探查器程序面临的另一个问题是分支机构。

我需要改变这个:

hi guys.
Another problem facing in my profiler program is with branches.
I need to change this:

展开 < span class =codeDivider> | 选择 | Wrap | Line数字

推荐答案

Sebouh-


你能说清楚你的问题吗?将所有循环和条件语句放在括号中是个好主意,以防万一你想稍后返回并添加一些东西,而if语句,如果你没有括号,只会执行下一行(但是,你可以做if - if - if语句链,但这不是好习惯)。我建议在括号内执行if语句时包括你想要完成的所有内容,但同样,我不确定我理解你的问题......
Sebouh-

Could you please clarify your qestion? It''s a good idea to put all loop and conditional statements in brackets, just in case you want to go back later and add something, and if statements, if you don''t have the brackets, will execute only the statement on the next line (however, you can do chains of if - if - if statements, but it''s not good practice). I would suggest including everything you want to be done when an ''if'' statement is executed inside brackets, but again, I''m not sure I understand your question...



Sebouh-


你能说清楚你的问题吗?将所有循环和条件语句放在括号中是个好主意,以防万一你想稍后返回并添加一些东西,而if语句,如果你没有括号,只会执行下一行(但是,你可以做if - if - if语句链,但这不是好习惯)。我建议在括号内执行if语句时包括你想要完成的所有内容,但同样,我不确定我理解你的问题......
Sebouh-

Could you please clarify your qestion? It''s a good idea to put all loop and conditional statements in brackets, just in case you want to go back later and add something, and if statements, if you don''t have the brackets, will execute only the statement on the next line (however, you can do chains of if - if - if statements, but it''s not good practice). I would suggest including everything you want to be done when an ''if'' statement is executed inside brackets, but again, I''m not sure I understand your question...



好​​的,让我解释得更好。

我想计算分支的次数,这就是我添加分支[i] ++的原因。我总是可以打开一个braket,把分支的东西放在那里与其他陈述,然后关闭braket。但我不知道什么时候关闭braket。语句(或ifs链)何时结束?我需要知道它们什么时候结束,这样我就可以让'关闭第一个if''braket。

OKay, let me explain better.
I want to count how many times the branch is taken, that''s why i add a branch[i]++. I can always open a braket, put the branch thing there with the other statements and then close the braket. But i don''t know when to close the braket. When do the statements (or chain of ifs) end? I need to know when they end so that i can let''s say close the first if''s braket.



OKay,让我解释得更好。

我想计算分支的次数,这就是我添加分支[i] ++的原因。我总是可以打开一个braket,把分支的东西放在那里与其他陈述,然后关闭braket。但我不知道什么时候关闭braket。语句(或ifs链)何时结束?我需要知道他们什么时候结束,以便我可以说'关闭第一个if'的braket。
OKay, let me explain better.
I want to count how many times the branch is taken, that''s why i add a branch[i]++. I can always open a braket, put the branch thing there with the other statements and then close the braket. But i don''t know when to close the braket. When do the statements (or chain of ifs) end? I need to know when they end so that i can let''s say close the first if''s braket.



在if语句中,它已全部完成或未完成。它结束了你想要的地方,在完成所有事情后你想要发生所选择的分支:

In an if statement, it''s either all done, or not. It ends where you want it to, after everything has been done that you want to happen if the selected branch has been taken:

展开 | 选择 | 换行 | 行号


这篇关于修改if语句但是使用大括号问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆