VB中Function函數(shù)
1 回答

守候你守候我
TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超10個(gè)贊
function關(guān)鍵字指定一個(gè)函數(shù)/過程可以返回特定值,如:
public Function YourNeed(Param as integer)as integer
.......
.......
Yourneed=100
End Function
過程在最后返回100的值,如調(diào)用a=YourNeed(10),則a=100。
而sub過程則無(wú)法返回值,如:
public sub YourNeed(Param as integer)
.......
.......
Yourneed=100'此處語(yǔ)句雖然存在,但無(wú)效
End sub
在其它過程調(diào)用sub Yourneed過程時(shí),如a=Yourneed(100)編譯器則報(bào)錯(cuò)。
添加回答
舉報(bào)
0/150
提交
取消