VB中Function函数

来源:百度知道 编辑:UC知道 时间:2024/05/15 18:03:50
Function Item(A, k)
.......
.......
End Function

function关键字指定一个函数/过程可以返回特定值,如:
public Function YourNeed(Param as integer)as integer
.......
.......
Yourneed=100
End Function
过程在最后返回100的值,如调用a=YourNeed(10),则a=100。
而sub过程则无法返回值,如:
public sub YourNeed(Param as integer)
.......
.......
Yourneed=100'此处语句虽然存在,但无效
End sub
在其它过程调用sub Yourneed过程时,如a=Yourneed(100)编译器则报错。

这是什么问题?