多行 If 语句
我有一个包含多个条件的 if
语句。我无法在一个窗口视图中看到它们全部。有没有办法将它们分开在不同的行上,或者它们必须全部写在一行中?
I have an if
statement with multiple conditions. I cannot see them all in a single window view. Is there a way to separate them on different lines or do they have to be written all in one line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
VBA 行继续符是下划线
_
The VBA line-continuation character is an underscore
_
可以使用续行符
_
这些都是一样的:
You can use the line continuation character
_
These are all the same:
与上面一样,您可以使用下划线分解一个“IF”语句中的长条件集。
如果条件太多,我觉得阅读起来有困难,我会用 BOOLEANS 来表示条件。看起来代码有点多,但我觉得更容易阅读。
如果我有一个需要执行以下操作的场景:
我可以这样做:
...或者我可以这样做...
当然,定义了示例 BOOLEAN 变量,我将使用而不是像 blnCondition1 这样的名称有意义的名字。
再说一次,这只是我的一个偏好。
Like the above, you can break up the long set of conditions in one "IF" statement by using an underscore.
If there are too many conditions and I find it challenging to read, I use BOOLEANS to represent the conditions. It seems like there is more code, but I find it easier to read.
If I have a scenario where I need to do the following:
I could do this:
... or I could do this ...
Of course, the example BOOLEAN variables are defined, and instead of names like blnCondition1, I'll use meaningful names.
Again, it's just a preference I have.
用低于分数 _ 来打破它们?
Microsoft 库
上面链接中的
break them with an under score _ ?
Microsoft Library
from above link
我非常确定您可以使用下划线
_
来分隔行。im pretty sure you can use an underscore
_
to break up lines.