函数和子函数之间有什么区别? [英] What's the difference between a function and a sub?

查看:127
本文介绍了函数和子函数之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C#的新手,在我的学习中遇到过一些VB .NET代码。我注意到VB使用函数和子函数,并且想知道

的区别是什么。这是一个有返回值而另一个没有吗?

I am a newbie to C# and have come across some VB .NET code in my studies. I
notice that VB uses functions and subs, and was wondering what the difference
was. Is it that one has a return value and the other doesn''t?

推荐答案

" cashdeskmac" < CA ********* @ discussions.microsoft.com> schrieb
"cashdeskmac" <ca*********@discussions.microsoft.com> schrieb
我是C#的新手,在我的
研究中遇到过一些VB .NET代码。我注意到VB使用了函数和subs,并且想知道
的区别是什么。这是一个有回报值而另一个没有吗?
I am a newbie to C# and have come across some VB .NET code in my
studies. I
notice that VB uses functions and subs, and was wondering what the
difference was. Is it that one has a return value and the other
doesn''t?




是的,它是。


Armin



Yes, it is.

Armin




以及byref参数一个sub也可以返回值,,,,


如果你可以关注我,可能是一个更好的解释,是一个sub是一个

方法,它不会通过方法名返回值,而且函数是一个

方法可以通过它的方法名返回值

" Armin Zingler" < AZ ******* @ freenet.de>在消息中写道

news:uq ************** @ TK2MSFTNGP14.phx.gbl ...

well with byref parameters a sub can also return values ,,,,

maybe a better explanation if you can follow me , is that a sub is a
method that doesn`t return values by its method name , and a function is a
method that can return values by it`s method name
"Armin Zingler" <az*******@freenet.de> wrote in message
news:uq**************@TK2MSFTNGP14.phx.gbl...
" cashdeskmac" < CA ********* @ discussions.microsoft.com> schrieb
"cashdeskmac" <ca*********@discussions.microsoft.com> schrieb
我是C#的新手,在我的
研究中遇到过一些VB .NET代码。我注意到VB使用了函数和subs,并且想知道
的区别是什么。是一个有回报值而另一个没有吗?
I am a newbie to C# and have come across some VB .NET code in my
studies. I notice that VB uses functions and subs, and was wondering
what the
difference was. Is it that one has a return value and the other
doesn''t?



是的,它是。

Armin



Yes, it is.

Armin



" m.posseth" < MI ***** @ nohausystems.nl> schrieb
"m.posseth" <mi*****@nohausystems.nl> schrieb

与byref参数一样,sub也可以返回值,,,,


是,但不是函数值。这就是他的意思(可能)。

如果你能跟着我,可能是一个更好的解释,是一个sub是一个没有通过方法名返回值的方法
函数是一种可以通过它的方法名称返回值的方法

Armin Zingler。 < AZ ******* @ freenet.de>在消息中写道
新闻:uq ************** @ TK2MSFTNGP14.phx.gbl ...

well with byref parameters a sub can also return values ,,,,
Yes, but not as the function value. That''s what he meant (probably).
maybe a better explanation if you can follow me , is that a sub is
a method that doesn`t return values by its method name , and a
function is a method that can return values by it`s method name
"Armin Zingler" <az*******@freenet.de> wrote in message
news:uq**************@TK2MSFTNGP14.phx.gbl...
" cashdeskmac" < CA ********* @ discussions.microsoft.com> schrieb
"cashdeskmac" <ca*********@discussions.microsoft.com> schrieb
我是C#的新手,在我的
研究中遇到过一些VB .NET代码。我注意到VB使用函数和subs,并且想知道
的区别是什么。这是一个有返回值而
其他不是吗?
I am a newbie to C# and have come across some VB .NET code in my
studies. I notice that VB uses functions and subs, and was
wondering what the
difference was. Is it that one has a return value and the
other doesn''t?



是的,它是。

Armin



Yes, it is.

Armin



这篇关于函数和子函数之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆