Събитие
Създаване на интелигентни приложения
17.03, 21 ч. - 21.03, 10 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сегаТози браузър вече не се поддържа.
Надстройте до Microsoft Edge, за да се възползвате от най-новите функции, актуализации на защитата и техническа поддръжка.
A Function
procedure returns a value to the calling code either by executing a Return
statement or by encountering an Exit Function
or End Function
statement.
Put a Return
statement at the point where the procedure's task is completed.
Follow the Return
keyword with an expression that yields the value you want to return to the calling code.
You can have more than one Return
statement in the same procedure.
The following Function
procedure calculates the longest side, or hypotenuse, of a right triangle, and returns it to the calling code.
Function Hypotenuse(side1 As Double, side2 As Double) As Double
Return Math.Sqrt((side1 ^ 2) + (side2 ^ 2))
End Function
The following example shows a typical call to hypotenuse
, which stores the returned value.
Dim testLength, testHypotenuse As Double
testHypotenuse = Hypotenuse(testLength, 10.7)
In at least one place in the Function
procedure, assign a value to the procedure's name.
When you execute an Exit Function
or End Function
statement, Visual Basic returns the value most recently assigned to the procedure's name.
You can have more than one Exit Function
statement in the same procedure, and you can mix Return
and Exit Function
statements in the same procedure.
You can have only one End Function
statement in a Function
procedure.
For more information and an example, see "Return Value" in Function Statement.
Обратна връзка за .NET
.NET е проект с отворен код. Изберете връзка, за да предоставите обратна връзка:
Събитие
Създаване на интелигентни приложения
17.03, 21 ч. - 21.03, 10 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сегаОбучение
Модул
Create C# methods that return values - Training
This module covers the return keyword and returning values from methods.
Документация
Return Statement - Visual Basic
Learn more about: Return Statement (Visual Basic)
Concatenation Operators in Visual Basic
Learn more about: Concatenation Operators in Visual Basic
Learn more about: Exit Statement (Visual Basic)