单选题
下列过程定义正确的是______。
A、
Private Function fun(x As Integer)fun=x+1End Function
B、
Private Sub pro(x As Integer) as IntegerPrint xEnd Sub
C、
Private Sub pro(x As Integer)pro=x+1End Sub
D、
Private Function fun(x As Integer) As IntegerPrint xfun="True"End Function
【正确答案】
A
【答案解析】
[解析] Function过程可以有返回值,而Sub过程不能带返回值,B选项中Sub过程定义了返回值类型,故B选项错误。在Function过程中,可以使用过程名返回返回值,但在Sub过程中,不可使用,故C选项错误。D选项中,Function过程中定义的返回值类型和实际返回的数据类型不一致,故D选项错误,所以答案为A选项。
提交答案
关闭