国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 无棣县| 兰西县| 洛南县| 冕宁县| 丰台区| 长乐市| 惠州市| 伽师县| 交城县| 南部县| 安丘市| 井陉县| 虎林市| 敦化市| 阆中市| 长阳| 巴林左旗| 广宁县| 双桥区| 乡城县| 南木林县| 望江县| 班戈县| 浦城县| 泊头市| 黎川县| 大理市| 大田县| 博乐市| 顺平县| 黑山县| 定日县| 措勤县| 襄樊市| 安龙县| 互助| 山东省| 岗巴县| 榆社县| 平顶山市| 上蔡县|