VB中难题
来源:百度知道 编辑:UC知道 时间:2024/06/09 21:36:07
我想问问为什么VB中有些代码是不对称的,就像这样
if button=vbleftbutton then
if shift=vbaltmask then
pse(x,y),vbwhite
else
这里的if shift=vbaltmask then就跟if button=vbleftbutton then不对称,而pse(x,y),vbwhite也跟if shift=vbaktmask then不对称
if button=vbleftbutton then
if shift=vbaltmask then
pse(x,y),vbwhite
else
这里的if shift=vbaltmask then就跟if button=vbleftbutton then不对称,而pse(x,y),vbwhite也跟if shift=vbaktmask then不对称
这只是为了方便程序员编写程序和他人读程序而写的格式,看起来比较整齐,易读。跟程序的执行没有关系。比如:
if 。。。。then
else
if .....then
else
end if
end if
一看就知道哪一个if和下面的else,end if是一组。
If ... Then
...
Else
...
End If
上面是正常模式。
--------------------------------------
If ... Then
XYZ
Else
ABC
End If
XYZ 可以是一个 If 语句,也就是嵌套。
如:
If ... Then
If ... Then
XYZ
Else
DEF
End If
Else
ABC
End If
只是嵌套关系。
代码格式嘛。只要能运行,怎么写是程序员自己决定的,当然,还是提倡规范写法的。毕竟写过的代码还要给自己和其他人看的。写的和天书一样,谁都不会去看的。
每个等级区分开了 方便看啊