国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

Chapter 3 Major VB.NET Changes(3)

2024-07-10 13:02:35
字體:
來源:轉載
供稿:網友
in vb6, you could call this sub in one of two ways:
foo “hello ”
call foo(“hello ”)
in vb.net, you also could call this sub in one of two ways:
foo(“hello ”)
call foo(“hello ”)
the difference, of course, is that the parentheses are always required in the vb.net
calls, even though you aren’t returning anything. the call statement is still sup-ported,
but it is not really necessary.
changes to boolean operators
the and , not , and or operators were to have undergone some changes. microsoft
originally said that the operators would short-circuit, but now they are staying the
way they worked in vb6. this means that in vb.net, as in vb6, if you had two
parts of an and statement and the first failed, vb6 still examined the second part.
examine the following code:
dim x as integer
dim y as integer
x =1
y =0
if x =2 and y =5/y then
...
as a human, you know that the variable x is equal to 1 . therefore, when you look at
the first part of the if statement, you know that x is not equal to 2 , so you would log-ically
think it should quit evaluating the expression. however, vb.net examines the
second part of the expression, so this code would cause a divide-by-zero error.
if you want short-circuiting, vb.net has introduced a couple of new operators:
andalso and orelse . in this case, the following code would not generate an error in
vb.net:
dim x as integer
dim y as integer
x =1
y =0
if x =2 andalso y =5/y then
...
this code does not cause an error; instead, because x is not equal to 2 , vb.net does
not even examine the second condition.
注冊會員,創(chuàng)建你的web開發(fā)資料庫,
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 大丰市| 清镇市| 大厂| 宁城县| 广州市| 正镶白旗| 讷河市| 舟曲县| 武冈市| 桃江县| 沽源县| 阳山县| 山阳县| 定兴县| 阳信县| 邵阳市| 新安县| 舒兰市| 彭泽县| 金山区| 鹤岗市| 墨脱县| 眉山市| 济宁市| 塔城市| 会理县| 文成县| 文化| 乡城县| 新乡市| 共和县| 奉贤区| 富裕县| 崇仁县| 鄄城县| 天全县| 烟台市| 兖州市| 卓资县| 大方县| 宝山区|