呼叫方法当一个方法被呼叫执行时, 可能会下列三种情况会发生:会有传回值(return a value)不具有传回值(return a value), 但其资料值是由宣告产生例外处理, 本部份将留到第12章再详细讨论不管是以上的那一种, 皆会直接跳至被呼叫的方法中执行其程式...
基于4个网页-相关网页
Fuction should return a value 函数必需返回一个值
unction should return a value 油膏应该返回一个值
Functions return a value 功能过程返回一个值
A Return Value Of 返回值为
该函数没有返回值。
Notice that the username_taken method does not return a value.
注意,username_taken方法并没有返回值。
The code can do any necessary processing and optionally return a value.
代码可以完成任何必需的处理,并且可以可选地返回一个值。
So you're implementing this black box, and if its purpose in life is to actually return a value, you have to tell the compiler what kind of value to expect, and this is going to have ripple effects.
你在实现这个黑盒子,如果它的目的是,返回一个值,你必须告诉编译器你期望的是什么类型的值,这个将是一个连锁反应。
And then the only other difference is obviously, it's a function I need to return a value.
然后还剩下一点明显的区别,对于方法我要有返回值。
And if it returns a value, you've got to do something with that return value too, much like we did up here.
如果它返回了一个值,你便用那个返回值,做一些事情,就像我们刚在上面做的。
应用推荐